Platform SDK: Windows Sockets

Multiple Handles to a Single Socket

Since what are duplicated are the socket descriptors and not the underlying sockets, all of the states associated with a socket are held in common across all the descriptors. For example a WSPSetSockOpt operation performed using one descriptor is subsequently visible using a WSPGetSockOpt from any or all descriptors.

Notification on shared sockets is subject to the usual constraints of WSPAsyncSelect and WSPEventSelect. Issuing either of these calls using any of the shared descriptors cancels any previous event registration for the socket, regardless of which descriptor was used to make that registration. Thus, for example, it would not be possible to have process A receive FD_READ events and process B receive FD_WRITE events. For situations when such tight coordination is required, it is suggested that developers consider using threads instead of separate processes.