sockets and select
Nathaniel Ingersoll
natei at sco.COM
Wed Feb 28 05:31:41 AEST 1990
In article <4309 at helios.TAMU.EDU> dhess at cs.tamu.edu (David K Hess)
asks why select() for reading on an NDELAY socket always seems to
return a fact that the socket has data.
The manual page:
.
. SELECT(S) UNIX System V SELECT(S)
. ...
. Description
. select examines the I/O descriptor sets whose addresses are
. passed in readfds, writefds, and exceptfds to see if some of
. their descriptors are ready for reading, are ready for
. writing, or have an exceptional condition pending,
. respectively. The first nfds descriptors are checked in
"Ready" for reading/writing probably means that the read or the write
will filled without blocking, and since the NDELAY bit has been set,
read() will always work without blocking.
You should either
(use NDELAY && not use select())
||
(use select() && not NDELAY)
--
________________________________________________________________________________
I told the police that I was not injured,
but on removing my hat, I found that I
had a skull fracture. -- from an insurance accident form
More information about the Comp.unix.wizards
mailing list