Closing Sockets

WSPCloseSocket releases the socket descriptor so that any pending operations in any threads of the same process will be aborted, and any further reference to it will fail. Note that a reference count should be employed for shared sockets, and only if this is the last reference to an underlying socket, should the information associated with this socket be discarded, provided graceful close is not requested (i.e., SO_DONTLINGER is not set). In the case of SO_DONTLINGER being set, any data queued for transmission will be sent if possible before information associated with the socket is released. See WSPCloseSocket for more information.

For non-IFS service providers, WPUCloseSocketHandle must be invoked to release the socket handle back to the WinSock 2 DLL.