The WSPSendDisconnect function initiates termination of the connection for the socket and sends disconnect data.
int WSPSendDisconnect (
SOCKET s,
LPWSABUF lpOutboundDisconnectData,
LPINT lpErrno
);
WSPSendDisconnect is used on connection-oriented sockets to disable transmission, and to initiate termination of the connection along with the transmission of disconnect data, if any.
After this function has been successfully issued, subsequent sends are disallowed.
lpOutboundDisconnectData, if not NULL, points to a buffer containing the outgoing disconnect data to be sent to the remote party.
Note that WSPSendDisconnect does not close the socket, and resources attached to the socket will not be freed until WSPCloseSocket is invoked.
WSPSendDisconnect does not block regardless of the SO_LINGER setting on the socket.
A Windows Sockets SPI client should not rely on being able to re-use a socket after it has been WSPSendDisconnected. In particular, a Windows Sockets provider is not required to support the use of WSPConnect on such a socket.
If no error occurs, WSPSendDisconnect returns zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code is available in lpErrno.
WSAENETDOWN | The network subsystem has failed. |
WSAENOPROTOOPT | The parameter lpOutboundDisconnectData is not NULL, and the disconnect data is not supported by the service provider. |
WSAEINPROGRESS | A blocking Windows Sockets call is in progress, or the service provider is still processing a callback function. |
WSAENOTCONN | The socket is not connected (connection-oriented sockets only). |
WSAENOTSOCK | The descriptor is not a socket. |
WSAEFAULT | The lpOutboundDisconnectData argument is not totally contained in a valid part of the user address space. |
Windows NT: Yes
Windows: Yes
Windows CE: Unsupported.
Header: Declared in ws2spi.h.