sockets and select

Larry McVoy lm at snafu.Sun.COM
Sun Feb 25 07:19:37 AEST 1990


In article <4309 at helios.TAMU.EDU> dhess at cs.tamu.edu (David K Hess) writes:
>	When I perform select() calls for reading only, strange
>things happen. At first the call works correctly and I empty the
>socket and do another select.  Then after a while, when I perform a
>recv() on the "selected" socket I get 0 bytes.  Yet when I select
>again I get the same socket ready for reading.  Pretty soon they are
>all doing it and select() has become as useful as polling.

This sounds like you are getting EOF on the socket.  If my memory serves
me correctly, if one does a select() to see if a socket is ready for reading
and the select says "yes" but a read says "0 bytes," that means that the 
other end of the connection went away.  I could be wrong - this is based
on socket hacking I did about 4 years ago under 4.2 (4.3?) BSD on a vax.
---
What I say is my opinion.  I am not paid to speak for Sun, I'm paid to hack.
    Besides, I frequently read news when I'm drjhgunghc, err, um, drunk.
Larry McVoy, Sun Microsystems     (415) 336-7627       ...!sun!lm or lm at sun.com



More information about the Comp.unix.wizards mailing list