Blocking I/O

The simplest form of I/O in Windows Sockets 2 is blocking I/O. As mentioned in section Socket Attribute Flags and Modes, sockets are created in blocking mode by default. Any I/O operation with a blocking socket will not return until the operation has been fully completed. Thus, any thread can only execute one I/O operation at a time. For example, if a thread issues a receive operation and no data is currently available, the thread will block until data becomes available and is placed into the thread's buffer. Although this is simple, it is not necessarily the most efficient way to do I/O in all versions of Windows. In Win16 environments for example, blocking is strongly discouraged due to the non-preemptive nature of the operating system (see section Pseudo vs. True Blocking for more information).