When an application issues one of the socket input functions and there is no data to read, the function blocks and does not return until there is data to read.
Similarly, an application can block on a socket output function when data cannot be sent immediately. Finally, connect() and accept() can block while waiting for connection establishment with the partner's programs.
Sockets provide a method that enables application
programs to issue functions that block so that the function returns without
delay. This is done by either calling fcntl() to turn on
the O_NONBLOCK flag, or calling ioctl() to turn
on the FIONBIO flag. When running in this nonblocking mode, if a function
cannot be completed without blocking, it returns immediately. A connect() might
return with [EINPROGRESS], which means that the connection initiation has
been started. You can then use the poll() or select() to
determine when the connection has been completed. For all other functions
that are affected by running in the nonblocking mode, an error code of [EWOULDBLOCK]
indicates that the call was unsuccessful.