On Wed, May 12, 2010 at 2:55 PM, Anomit Ghosh <anomit.gh...@gmail.com> wrote: > This is the code in question: http://codepad.org/7eD9n14B > Run the code as `./server 127.0.0.1 <port number>` > > I registered a callback(sock_callback) on the listening socket that > puts the new connections after accepting in a list. Now the problem > seems to be that even after doing event_add() in L73 the connection > closes immediately. I tested this by using telnet to connect to the > server. The printf() on L62 gets printed properly but nothing else > works properly. Where am I going wrong? Even a little help would be > appreciated (I'm kind of on a tight schedule :-| ).
Hm. It works for me, so I'm suspecting something platform-dependent. My first guess is that you're calling accept() wrong: you need to initialize addrlen to sizeof(client_addr) before you call it, if I'm reading the accept() documentation right. But try checking for errors on all of your syscalls to catch stuff like that, and see if that's what the problem is? -- Nick *********************************************************************** To unsubscribe, send an e-mail to majord...@freehaven.net with unsubscribe libevent-users in the body.