LPWSPRECVDISCONNECT callback function (ws2spi.h)

The LPWSPRecvDisconnect function terminates reception on a socket and retrieves the disconnect data, if the socket is connection oriented.

Syntax

LPWSPRECVDISCONNECT Lpwsprecvdisconnect;

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

Parameters

[in] s

Descriptor identifying a socket.

[out] lpInboundDisconnectData

Pointer to a buffer into which disconnect data is to be copied.

[out] lpErrno

Pointer to the error code.

Return value

If no error occurs, LPWSPRecvDisconnect 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.
WSAEFAULT
Buffer referenced by the parameter lpInboundDisconnectData is too small.
WSAENOPROTOOPT
Disconnect data is not supported by the indicated protocol family.
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.

Remarks

LPWSPRecvDisconnect is used on connection-oriented sockets to disable reception, and retrieve any incoming disconnect data from the remote party.

After this function has been successfully issued, subsequent receives on the socket will be disallowed. This has no effect on the lower protocol layers. For TCP, the TCP window is not changed and incoming data will be accepted (but not acknowledged) until the window is exhausted. For UDP, incoming datagrams are accepted and queued. In no case will an ICMP error packet be generated.

To successfully receive incoming disconnect data, a Windows Sockets SPI client must use other mechanisms to determine that the circuit has been closed. For example, a client needs to receive an FD_CLOSE notification, or get a zero return value, or a WSAEDISCON error code from LPWSPRecv.

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

Note

LPWSPRecvDisconnect 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 LPWSPRecvDisconnected. 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