sockets and select
D. Jason Penney
penneyj at servio.UUCP
Thu Mar 1 06:33:48 AEST 1990
In article <4990 at scolex.sco.COM> natei at sco.com writes:
>"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)
>--
If I came across a system that did this, I would regard it as horribly
broken. I use select() on non-blocking sockets in SunOS 4.0, Ultrix,
Sony NEWS-OS, AIX, and other places, and on NONE of them does select()
return a bit in readfd's unless there is at least one byte to read.
Since 0 bytes is used in both nonblocking and blocking mode to indicate
eof, if I saw that a socket was ready to read with 0 bytes left to read
in it, I would immediately close() it.
--J
--
D. Jason Penney Ph: (503) 629-8383
Beaverton, OR 97006 uucp: ...uunet!servio!penneyj (penneyj at slc.com)
"Computers are useless; they can only give answers" -- Picasso
More information about the Comp.unix.wizards
mailing list