apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davi Arnaut <d...@haxent.com.br>
Subject Re: [Fwd: Re: How to detect is the socket is still open]
Date Wed, 16 Aug 2006 13:48:09 GMT

Em 16/08/2006, às 10:24, Justin Erenkrantz escreveu:

> On Wed, Aug 16, 2006 at 08:55:44AM +0100, Joe Orton wrote:
>> POLLERR would only be set for an RST and "exceptional conditions";  
>> the
>> same applies to select()+the exceptfds array AFAIK.
>> There is some inconsistency with handling FIN and sockets across
>> platforms: http://www.greenend.org.uk/rjk/2001/06/poll.html but yes
>> you'd generally expect POLLIN for "you can read EOF".
> Back to our original question: how can we portably detect that the  
> socket is
> still alive?  We can't do a non-blocking read() either...  -- justin


The only portable way to "detect" a broken connection is using  
or to write/read "ping" data through the socket -- which is what  
keepalive does.

There is no other way around this, most network protocols are timeout  

Davi Arnaut
View raw message