|
Boost Users : |
Subject: Re: [Boost-users] Boost::asio - how to detect if a remote sockets client has disconnected
From: Jonathan Franklin (franklin.jonathan_at_[hidden])
Date: 2009-07-25 13:43:15
On Sat, Jul 25, 2009 at 11:27 AM, Igor R<boost.lists_at_[hidden]> wrote:
>> I've read I can try to read from the socket, but in HTTP the client
>> sends the request, and doesn't write any more to the socket.
>
> Probably you can try to write back to the socket, and check if this
> operation fails?
You would pretty much need to fill up the socket send buffer before it
even thinks about failing.
You might consider doing a test to see if attempting a non-blocking
read on the socket yields a pending read. For blocking reads, this
would result in an EOF if the client has dropped the connection, but
I'm not sure what will happen w/ the non-blocking reads on your system
without running a little test.
Jon
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