This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Problems with Sockets and select.


> 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:   blair@xvn.ds.boeing.com  * The contents of this message in    *
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]