> To avoid blocking, you *must* use nonblocking I/O even if you use
> select();
Correct.
> there's no rule saying read() and write() won't block if select()
> says they won't; select() can occasionally be wrong, or there might
> not be as many bytes available or writable as you expect. In
> this program,
> the call
> read(0, buf, sizeof buf)
> may well block in normal operation -- what if 1024 bytes aren't
> available?
Then you should get however many bytes are available without blocking.
However, you can never be sure a write won't block since resources that were
available when you left 'select' may no longer be available by the time you
get to 'write'.
With protocols other than TCP, reads can block even after select tells you
they won't. Imagine if, for example, 'select' returns a hit for read due to
an error condition but then the error condition clears.
DS
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]