[ENet-discuss] Enet Crash

Stefanus Johny stefanus at excite.com
Thu Aug 31 12:35:34 PDT 2006


The server.

I think the problem is the server puts data into the send buffer through enet_peer_send() faster than what enet actually transmits. So eventually the buffer overflows and caused it to segfault.

Here's what valgrind says:
==15095== Process terminating with default action of signal 11 (SIGSEGV)
==15095==  GPF (Pointer out of bounds?)
==15095==    at 0x804A6F0: enet_protocol_send_reliable_outgoing_commands (protocol.c:1040)
==15095==    by 0x804A9F7: enet_protocol_send_outgoing_commands (protocol.c:1137)
==15095==    by 0x804B1C7: enet_host_service (protocol.c:1275)
==15095==    by 0x8048C95: eventloop (in /home/johny/rtp/enet/edpserver)
==15095==    by 0x73DB7F: start_thread (in /lib/libpthread-2.3.5.so)
==15095==    by 0x5AEDED: clone (in /lib/libc-2.3.5.so)

By introducing some delay between enet_peer_send() seems to fix the problem, but is there another solution to this? 

Thanks.

-Stefanus



 --- On Wed 08/30, Kevin Gadd < kevin.gadd at gmail.com > wrote:
From: Kevin Gadd [mailto: kevin.gadd at gmail.com]
To: stefanus at excite.com, enet-discuss at cubik.org
Date: Wed, 30 Aug 2006 15:00:34 -0700
Subject: Re: [ENet-discuss] Enet Crash

Does the server segfault or does the client?On 8/30/06, Stefanus Johny <stefanus at excite.com> wrote:
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.comThe most personalized portal on the Web!_______________________________________________ENet-discuss mailing list
ENet-discuss at cubik.orghttp://lists.cubik.org/mailman/listinfo/enet-discuss


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




More information about the ENet-discuss mailing list