Jonathan Franklin wrote:
On Mon, Jul 27, 2009 at 10:17 AM, Etienne Philip Pretorius
wrote: SO_KEEPALIVE?
SO_KEEPALIVE just tries to prevent one end from closing a connection that has been idle for too long under "normal" operation.
The problem we're trying to detect is when the other side of the connection drops off silently so we don't waste time *writing* data to the connection. This is an error condition, SO_KEEPALIVE won't help AFAICT.
Then the others have answered the question. Whether you use async/blocking/non-blocking (dispatch method) you will only get an error if the underlying Network OS thinks that there is an error. In TCP, there should be a FIN state that the Network OS should pick up as the close call on the socket. Anyway - there is no 100% way to establish that this was because the client disconnected or the link between the two went down. There is a possibility that a shutdown on the read side from the server could cause the Network OS to detect if there is no ACK from the client when the half close is called. Also at that stage if the shutdown was ACK'ed you will get a read call with NO ERROR and 0 bytes read.
Jon _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users