select() says no activity, but recv() returns data!

News system owner ID news at bbn.com
Thu Jun 7 23:57:35 AEST 1990


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 at 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



More information about the Comp.unix.wizards mailing list