Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!seismo!sundc!newstop!sun!snafu!lm From: lm@snafu.Sun.COM (Larry McVoy) Newsgroups: comp.unix.wizards Subject: Re: sockets and select Keywords: socket select Message-ID: <132218@sun.Eng.Sun.COM> Date: 24 Feb 90 20:19:37 GMT References: <4309@helios.TAMU.EDU> Sender: news@sun.Eng.Sun.COM Reply-To: lm@sun.UUCP (Larry McVoy) Distribution: usa Organization: Sun Microsystems, Mountain View Lines: 17 In article <4309@helios.TAMU.EDU> dhess@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@sun.com