question on select() and sockets

Moellers josef at nixdorf.de
Fri Nov 16 18:16:39 AEST 1990


In <ABDIK.90Nov14162831 at lion.cat.syr.EDU> abdik at cat.syr.EDU (Ahmad Dik) writes:


>I would like to know if select() can be used to find out if there is
>a blocked read on a socket.

>In other words, will the second parameter of the select() function
>tell me if the socket's buffer is empty, and I can write to it, or  
>does it tell me that there is someone blocked trying to read from the socket.

>If select can not be used to tell if anyone is blocked reading on a
>socket, is there any other way I can find out ??

The second parameter tells You if You can write to the socket.
That does not mean that the buffer has to be empty, just that there is
enough room to accomodate a write(). It doesn't tell You how much You'll
be able to write.
Needless to say: it's a vector with a bit for each fd.

To my knowledge there is no way of telling if anyone is blocked on the
other end of a connection as
1. the "other party" might be on a different machine far far away
2. the "other party" might not even be a UNIX box that knows what a
   "process" is or how one can "block".

--
=======
| Josef Moellers		| c/o Siemens Nixdorf Informatonssysteme AG |
|  USA: mollers.pad at nixdorf.com	| Abt. PXD-S14				    |
| !USA: mollers.pad at nixdorf.de	| Heinz-Nixdorf-Ring			    |



More information about the Comp.unix.internals mailing list