WSPRecvDisconnect (Windows CE 5.0)
This function terminates reception on a socket and retrieves the disconnect data, if the socket is connection oriented.
Note WSPRecvDisconnect is not supported for the default TCP/UDP provider in Windows CE. However, third parties can implement their own provider and have support for this function if they choose.
int WSPRecvDisconnect(SOCKET s,LPWSABUF lpInboundDisconnectData,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 Values
This function always returns SOCKET_ERROR and sets lpErrno to WSASYSCALLFAILURE on Windows CE.
Remarks
This function 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 WSPRecvDisconnect does not close the socket, and resources attached to the socket will not be freed until WSPCloseSocket is invoked. Also, 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 disconnected by using WSPRecvDisconnect. In particular, a Windows Sockets provider is not required to support the use of WSPConnect on such a socket.
Requirements
OS Versions: Windows CE .NET 4.0 and later.
Header: Ws2spi.h.
Link Library: Ws2.lib.
See Also
Send Feedback on this topic to the authors