apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject Re: [Fwd: Re: How to detect is the socket is still open]
Date Wed, 16 Aug 2006 15:49:51 GMT
On Wed, Aug 16, 2006 at 12:36:23PM -0300, Davi Arnaut wrote:
> Em 16/08/2006, às 11:00, Justin Erenkrantz escreveu:
> >Would a non-blocking read() followed by a poll()/select() be useful?
> >We'd still get a 0 back from read() - but if it was the EOF, would the
> >state of the socket change to be in the 'exceptional' state then if we
> >repoll?  -- justin
> 
> Humm, read returning 0 is a EOF, you could also maybe
> getsockopt(SO_ERROR) on the socket to confirm the EOF.

SO_ERROR will only give an error in cases where a read or write would
fail and set errno; that's not true for EOF.

> Select is a different beast because of the definition of what is
> a "exceptional condition" which may be pending error conditions
> or oob data. I think the "exception fd" of select is similar to a poll
> with POLLPRI mask, so it shoud'nt signal a connection reset.

It's POLLERR, hopefully; that's how APR maps it anyway ;)

joe

Mime
View raw message