RE: PROBLEM: select() says closed socket readable

From: David Schwartz (davids@webmaster.com)
Date: Tue Aug 21 2001 - 14:01:25 EST


> > No, because 'select' is defined to work the same on both
> > blocking and
> > non-blocking sockets. Roughly, select should hit on read if a
> > non-blocking
> > read wouldn't return 'would block'.

> Select is not reliable for a blocking socket in all cases. There
> is always
> a risk select may return "data to read" and the read will find
> there is now
> none. It isnt going to bite anyone on Linux with our current protocols but
> it may bite portable code

        I should have continued my sentence with "if it was issued at the instant
'select' made that decision." Using 'select' on blocking sockets is usually
an error. Nevertheless, select itself is defined to work the same on both
blocking and non-blocking sockets. In general, there is no way the operating
system can make guarantees about the future state of a socket.

        DS

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 23 2001 - 21:00:44 EST