WSPRecvDisconnect function

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

Syntax


int WSPRecvDisconnect(
  _In_  SOCKET   s,
  _Out_ LPWSABUF lpInboundDisconnectData,
  _Out_ LPINT    lpErrno
);

Parameters

s [in]

Descriptor identifying a socket.

lpInboundDisconnectData [out]

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

lpErrno [out]

Pointer to the error code.

Return value

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

Error codeMeaning
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

WSPRecvDisconnect 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 WSPRecv.

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

Note  WSPRecvDisconnect 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 WSPRecvDisconnected. In particular, a Windows Sockets provider is not required to support the use of WSPConnect on such a socket.
 

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Ws2spi.h

See also

WSPConnect
WSPSocket

 

 

Show: