Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost::asio - how to detect if a remote socketsclient has disconnected
From: Alex Black (alex_at_[hidden])
Date: 2009-07-27 12:14:19


> On Sat, Jul 25, 2009 at 1:42 PM, Scott
> Gifford<sgifford_at_[hidden]> wrote:
> > If the client just disappears, you won't get any notification until
> > you try to send data (including the OS sending TCP
> Keepalives, if they
> > are enabled); then when that data send times out, you will get an
> > error, probably on your read or the next time you try to write.
>
> If the client silently drops off, I wouldn't count on getting
> an error from send until your TCP send buffer fills up.
> Depending on how large the request file/resource is, you may
> never know that the client dropped off. Writes basically
> always succeed if there is space in the buffer. If the
> response fits in the buffer, you'll write, close the socket,
> and never get an error. If the response is larger than the
> buffer, you'll fill up the buffer, block (assuming blocking
> io) until the send times out, and then possibly get an error
> (dependent on your TCP stack impl).

Thanks for the info. It sounds like there isn't any way to detect this
then.

Would doing synchronous writes (instead of asycnchronous writes) make
any difference?


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