O_NONBLOCK vs. O_NDELAY for non-blocking sockets

Gordon McMillan gmcm at hypernet.com
Tue May 25 09:59:39 EDT 1999


Hrvoje Niksic writes:

> Apparently the setblocking() method of socket objects is setting the
> O_NDELAY flag to set the socket to non-blocking mode.  However,
> _POSIX Programmer's Guide_ by Donald Lewine says:

[ when nothing there yet:
  POSIX: O_NONBLOCK
    -1; errno == EAGAIN
  BSD: O_NDELAY 
    -1; errno == EWOULDBLOCK
  SYSV: O_NDELAY
     0; errno == EWOULDBLOCK ]

All these flavors of sockets are available on HPUX. Python manages to 
build with BSD semantics. Maybe it's just dumb luck though <wink>, 
when I glance at configure, I don't see anything that sets this.

Don't have the docs around at the moment to check, but I think there 
some other subtle differences between BSD and POSIX sockets. As I 
recall, in the handling of OOB.

Cherry-red-Camaro-with-original-BSD-sockets-ly y'rs

- Gordon




More information about the Python-list mailing list