Platform SDK: Windows Sockets

Socket Attribute Flags and Modes

There are several socket attributes which can be indicated through the flags parameter in WSPSocket. The WSA_FLAG_OVERLAPPED flag indicates that a socket will be used for overlapped I/O operations. Support of this attribute is mandatory for all service providers. See Overlapped I/O for more information. Note that creating a socket with the overlapped attribute has no impact on whether a socket is currently in the blocking or nonblocking mode. Sockets created with the overlapped attribute may be used to perform overlapped I/O, and doing so does not change the blocking mode of a socket. Since overlapped I/O operations do not block, the blocking mode of a socket is irrelevant for these operations.

Four additional attribute flags are used when creating sockets that are to be used for multipoint and/or multicast operations, and support for these attributes is optional. Providers that support multipoint attributes indicate this through the XP1_SUPPPORT_MULTIPOINT bit in their respective WSAPROTOCOL_INFOW structures. See WSPSocket and section Protocol-Independent Multicast and Multipoint in the API for the definition and usage of each of these flags. Only sockets that are created with multipoint-related attributes can be used in the WSPJoinLeaf function for creating multipoint sessions.

A socket is in one of two modes, blocking and nonblocking, at any time. Sockets are created in the blocking mode by default, and can be changed to nonblocking mode by calling WSPAsyncSelect, WSPEventSelect, or WSPIoctl. A socket can be switched back to blocking mode by using WSPIoctl if no WSPAsyncSelect or WSPEventSelect is active. The mode for a socket only affects those functions which may block, and does not affect overlapped I/O operations. See section Blocking Operations for more information.