BOOL ShutDown( int nHow = sends );
Return Value
Nonzero if the function is successful; otherwise 0, and a specific error code can be retrieved by calling GetLastError. The following errors apply to this member function:
Parameters
nHow
A flag that describes what types of operation will no longer be allowed, using the following enumerated values:
Remarks
Call this member function to disable sends and/or receives on the socket. ShutDown is used on all types of sockets to disable reception, transmission, or both. If nHow is 0, subsequent receives on the socket will be disallowed. This has no effect on the lower protocol layers.
For Transmission Control Protocol (TCP), the TCP window is not changed and incoming data will be accepted (but not acknowledged) until the window is exhausted. For User Datagram Protocol (UDP), incoming datagrams are accepted and queued. In no case will an ICMP error packet be generated. If nHow is 1, subsequent sends are disallowed. For TCP sockets, a FIN will be sent. Setting nHow to 2 disables both sends and receives as described above.
Note that ShutDown does not close the socket, and resources attached to the socket will not be freed until Close is called. An application should not rely on being able to reuse a socket after it has been shut down. In particular, a Windows Sockets implementation is not required to support the use of Connect on such a socket.
Example
See the example for CAsyncSocket::OnReceive.
CAsyncSocket Overview | Class Members | Hierarchy Chart
See Also CAsyncSocket::Connect, CAsyncSocket::Create