LPWSPSENDDISCONNECT callback function (ws2spi.h)

The LPWSPSendDisconnect function initiates termination of the connection for the socket and sends disconnect data.

Syntax

LPWSPSENDDISCONNECT Lpwspsenddisconnect;

int Lpwspsenddisconnect(
  [in]  SOCKET s,
  [in]  LPWSABUF lpOutboundDisconnectData,
  [out] LPINT lpErrno
)
{...}

Parameters

[in] s

Descriptor identifying a socket.

[in] lpOutboundDisconnectData

Pointer to the outgoing disconnect data.

[out] lpErrno

Pointer to the error code.

Return value

If no error occurs, LPWSPSendDisconnect returns zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code is available in lpErrno.

Error Code Meaning
WSAENETDOWN
The network subsystem has failed.
WSAENOPROTOOPT
Parameter lpOutboundDisconnectData is not null, and the disconnect data is not supported by the service provider.
WSAEINPROGRESS
Blocking Windows Sockets call is in progress, or the service provider is still processing a callback function.
WSAENOTCONN
Socket is not connected (connection-oriented sockets only).
WSAENOTSOCK
The descriptor is not a socket.
WSAEFAULT
The lpOutboundDisconnectData parameter is not totally contained in a valid part of the user address space.

Remarks

The LPWSPSendDisconnect function 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.

The lpOutboundDisconnectData parameter, if not null, points to a buffer containing the outgoing disconnect data to be sent to the remote party.

Note that LPWSPSendDisconnect does not close the socket, and that resources attached to the socket will not be freed until LPWSPCloseSocket is invoked.

Note

The LPWSPSendDisconnect function does not block regardless of the SO_LINGER setting on the socket. A Windows Sockets SPI client should not rely on being able to reuse a socket after it has been disconnected. In particular, a Windows Sockets provider is not required to support the use of LPWSPConnect on such a socket.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Header ws2spi.h

See also

LPWSPConnect

LPWSPSocket