Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!umich!yale!mintaka!mit-eddie!bbn.com!news From: news@bbn.com (News system owner ID) Newsgroups: comp.unix.wizards Subject: select() says no activity, but recv() returns data! Message-ID: <57106@bbn.BBN.COM> Date: 7 Jun 90 13:57:35 GMT Reply-To: cbrooks@BBN.COM () Distribution: usa Organization: Bolt Beranek and Newman Inc., Cambridge MA Lines: 40 I'm observing some strange behavior when using a select() call on a Unix stream socket. Simply put, a select() with the fd set in the read file descriptor mask returns 0 (indicating that the file descriptor is not readable), but a subsequent recv() on that fd returns data. The following is a map of the behavior From: cbrooks@bbn.com (Charles L. Brooks) Path: bbn.com!cbrooks Client Server connect-> ->accept /* initial connection phase */ send-> ->recv <-send recv<- /* message reading loop */ /* here's where the select() returns 0 */ *** select <-send ?? // first message /* but this recv() returns data! recv<- // first message Other points of interest: 1) the socket in the client is set for non-blocking i/o. 2) once the recv of the first message is completed, select() (seems to) operate correctly 3) program run on a SparcStation1, Sun OS 4.0.3 Any hints, suggestions, references? Charlie Brooks 20/636 x3589