fcntl/ioctl and O_NONBLOCK

Donn Cave donn at oz.net
Sat Nov 27 12:06:18 EST 1999


Quoth hildeb at www.stahl.bau.tu-bs.de (Ralf Hildebrandt):
| On 26 Nov 1999 18:57:01 GMT, Donn Cave <donn at oz.net> wrote:
|
| >I don't know about the ioctl, but you may not need it after all if
| >you're already going to use select.  Select will tell you if the
| >I/O would block, if so then don't read.
|
| Ah! So a read only block if there's nothing at all to read?

Right - if there's anything to read, you will read only that and
not block.  (So of course you must always check how much you actually
have read!)  Select tells you precisely that your I/O won't block,
either because there's data to read or end of file.

|> (And you can't read from both ends, "stdin" (i.e., Popen3.tochild)
|> is opened for write and attempts to read from it will probably be
|> frustrating.)
|
| :) Yup. I read the sockets HOWTO by now, and select() on a file/pipe 
| is more or less the same on unix. 

I guess - except of course, sockets are bi-directional, and pipes are
one direction only.

	Donn Cave, donn at oz.net




More information about the Python-list mailing list