[ENet-discuss] Enet Crash

Stefanus Johny stefanus at excite.com
Wed Aug 30 13:58:05 PDT 2006


Hi,

I'm trying to use Enet to send as much data as possible down the pipe. The problem is mainly in the server side and here's the core of the server code:

void sendEnetPkt(char *data, int length){
  if(peer == NULL)
    return;

  /* Create a reliable packet */
  ENetPacket *packet = enet_packet_create(data, length,
                                    ENET_PACKET_FLAG_RELIABLE);

  /* Send the packet to the peer over channel id 0. */
  enet_peer_send(peer, 0, packet);

  /* One could just use enet_host_service() instead. */
  enet_host_flush(server);
}

int main (int argc, char **argv){
#define LENGTH 50*1024
  char data[LENGTH];
  .
  .
  .
  while(1){
    sendEnetPkt(data, LENGTH);
  }
  .
  .
}

client simply receives the data using enet_host_service() similar to the tutorial code.

when I run the code, Enet would send several thousand packets until it seg faulted.

Any help will be appreciated. Thanks in advance.

-Stefanus

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!




More information about the ENet-discuss mailing list