Re: [Libevent-users] detection of TCP disconnection

2011-11-22 Thread Catalin Patulea
On Tue, Nov 22, 2011 at 7:18 PM, wrote: > However if i a do hard reset(power off) of the machine running the client, > it does not seem to work and I believe I am not getting a callback > function for the event on the server. I think the fundamental problem is distinguishing between 'hard reset'

Re: [Libevent-users] detection of TCP disconnection

2011-11-22 Thread Dan Kegel
On Tue, Nov 22, 2011 at 4:18 PM, wrote: > In order to detect a "disconnection" by the client i look for a return > value of 0 from read() in the callback function. > > This seems to work correctly when i do a kill -INT on the client or a kill > -9 on the client: the callback is triggered on the s

[Libevent-users] detection of TCP disconnection

2011-11-22 Thread Ivan.Novick
Hello, I am adding an event to a connected TCP server with the flags EV_READ|EV_PERSIST and calling read() when i get a callback, in order to get the data from the client. In order to detect a "disconnection" by the client i look for a return value of 0 from read() in the callback function. This