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 17:21:28 GMT

Em 16/08/2006, às 12:49, Joe Orton escreveu:

> 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.

No, but moving on..

>
>> 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 ;)

It's POLLPRI, errors are not exceptional conditions.

--
Davi Arnaut


Mime
View raw message