Question about sockets (asynch)

Chris Torek torek at elf.ee.lbl.gov
Sun Jun 9 05:13:22 AEST 1991


In article <MYCROFT.91Jun8022148 at kropotki.gnu.ai.mit.edu>
mycroft at kropotki.gnu.ai.mit.edu (Charles Hannum) writes:
>If you use NULL for the timeout argument to select(2), it should wait
>for one of the file descriptors to become ready.  If you pass it a
>pointer to an integer set to 0, it will exit immediately.  Setting the
>files to non-blocking I/O should not make any difference.

Actually, that is a `pointer to a struct timeval'.  This is otherwise
correct.  Select is not supposed to base its `readiness' decision on
blocking/nonblocking modes; however, there have been some
implementation goofs in the past in this respect.  If you are stuck
with one of those you might have to clear nonblocking mode for the
duration of the select call.

In general, there is no reason to mix select and nonblocking I/O: since
select tells you which descriptors will not block, you can simply avoid
operations on those descriptors.  There are special cases, though (shared
descriptors, e.g.).
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA		Domain:	torek at ee.lbl.gov



More information about the Comp.unix.programmer mailing list