> >     If anyone thinks that 'select' or 'poll' guarantees that a future 
> > operation
> > will not block, even if it's a single operation, that's just plain not true.
> > The only way you can guarantee that even one operation will not block is if
> > you set the socket non-blocking.
> 
> Really.
> 
> I dont think the IEEE and POSIX specifications are publicly available to 
> quote you an extract.  However the Linux man page talks in those 
> specific terms of a descriptor becoming writingable means that a write 
> operation will not block (I think its widely accepted that they are 
> referring to only the next single invocation of write() will not block). 

Linux:
 Three independent sets of descriptors are  watched.   Those  listed  in
readfds will be watched to see if characters become available for read-
ing (more precisely, to see if a read will not block - in particular, a
file  descriptor  is also ready on end-of-file)

R. Stevens, Unix Network Programming, Volume 1, Second Edition, Section 
6.3, page 153:

1. A socket is ready for reading if any of the following four conditions 
is true:

a. The number of bytes of data in the socket receive buffer is greater 
than or equal to the current size of the low-water mark for the socket 
receive buffer. *** A read operation on the socket will not block and will 
return a value greater than 0 (i.e., the data that is ready to be read).*** 
We can set this low-water mark using the SO_RCVLOWAT socket option. It 
defaults to 1 for TCP and UDP sockets.

b. The read half of the connection is closed (i.e., a TCP connection that 
has received a FIN). A read operation on the socket will not block and 
will return 0 (i.e., EOF).

c. The socket is a listening socket and the number of completed 
connections is nonzero. 
An accept on the listening socket will normally not block, although we 
will describe a timing condition in Section 16.6 under which the accept 
can block.

d. A socket error is pending. A read operation on the socket will not 
block and will return an error (.1) with errno set to the specific error 
condition. These pending errors can also be fetched and cleared by calling 
getsockopt and specifying the SO_ERROR socket
option.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to