UNIX nonblocking I/O: O_NONBLOCK vs. FIONBIO In every example and discussion I run across in the context of BSD socket programming, it seems that the recommended way to set a file descriptor to nonblocking I/O mode is using the flag tofcntl(), e.g. int flags = fcntl(fd, F_GETFL, ...