apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mladen Turk <mt...@apache.org>
Subject Re: How to detect is the socket is still open
Date Wed, 02 Aug 2006 14:06:34 GMT
Joe Orton wrote:
 > On Wed, Aug 02, 2006 at 01:42:52PM +0200, Mladen Turk wrote:
 >> We have a problem with mod_proxy and the way how we detect if the
 >> connection is still opened.
 > Polling the socket is all you can do, but all that tells you is whether
 > the local end of the TCP socket has already received a FIN/RST.

Right. I'm aware of that, and all the problems. However it really
works only on windows.
The solution I had in my mind was to add a small
(1 byte should be enough) read-ahead buffer to the
socket. This way the next read would first use that buffer if
filled by apr_socket_is_connected call.
The point is that read with 0 timeout can return data,
and that breaks any attempt to check the status of the socket
without duplicating code for each protocol (http, ajp, ftp, etc...).


View raw message