Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost::asio - how to detect if a remotesocketsclient has disconnected
From: Igor R (boost.lists_at_[hidden])
Date: 2009-07-27 13:20:05


> So, if I attempt a read, will I be able to distinguish between these two
> scenarios:
> A) the client is no longer connected
> B) the client is connected but hasn't send anything since I last read
> (which is the case for HTTP clients I believe)

Yes, if you call async_read(), then in case of (A) your handler will
be called with some error_code (eg. eof), while in (B) nothing would
happen - async.read is pending until there's some data or error.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net