Subject: Re: Problems with Sockets and select.
From: [email-masked] (Tim Newsham)

2 Oct 1997 13:27:58 -0700
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
To: [email-masked] (Rick Blair)
Cc: [email-masked]

> Hi all,
> 
> This is a follow up to another post I made {with no replies :-( }
> 
> I have an application that does interprocess communication with sockets.
> The main server process does a select to multiplex I/O from the clients.  The
> select call completes, but when I go to read the socket with input pending,
> I block on the read call.  Which is strange, since select says there is input
> ready for that socket.
> 
> This same code works in almost all flavors of Unix that I have tried.
> 
> Any suggestions or work arounds would be helpfull.

In winsock, a read/recv() will block until the full amount
of data requested is available if you aren't in non-blocking
mode.  So if you do read(s, buf, 2), and there is only 1 byte
available, you will block until there are 2.  This is not the
same behavior observed in unix.  You can do an ioctl to determine
the number of bytes actually available after the select (FIONREAD)
and read only that amount, to avoid blocking.

> Rick
> * email:   [email-masked]  * The contents of this message in    *
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".