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 Hi, The only portable way to "detect" a broken connection is using SO_KEEPALIVE 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 based. -- Davi Arnaut