When doing select() on Linux on a TCP socket with a non-blocking 
connect() outstanding, when is exceptfds set?

I've thought a variety of things at different points -- maybe it signals
an error, maybe it signals that an asynchronous connect has failed,
maybe it means OOB data is available, etc.  But now I just don't know. 
Nor does the manpage, apparently:

http://linux.die.net/man/2/select_tut

 > exceptfds: This set is watched for exceptions or errors on any of the
 > file descriptors. However, that is actually just a rumor.

I've read (and seem to recall) that on Win32 exeptfds will be set when a 
non-blocking connect() call fails.  But this doesn't seem to be the case 
under Linux.  Rather, the only way I can find to detect a non-blocking 
connect() failure under Linux is to getsockopt(SO_ERROR).

Thus the question is: what does exceptfds mean on a non-blocking 
connect() on Linux?  It *doesn't* mean failure -- if I ignore it the 
connection goes through just fine.  And it can't mean OOB data, because 
I'm not sending any (and I control both sides of the connection, which 
is happening over localhost).

I haven't quite narrowed down when it happens but suddenly it's very 
common.  I made an optimization to process requests much faster... maybe 
that is meaning I call select() with zero timeout...  Unknown.

Any idea what it's trying to tell me?

-david


_______________________________________________
p2p-hackers mailing list
[email protected]
http://lists.zooko.com/mailman/listinfo/p2p-hackers

Reply via email to