Ends a pending asynchronous disconnect request.
Assembly: System (in System.dll)
The operating system is Windows 2000 or earlier, and this method requires Windows XP.
The Socket object has been closed.
asyncResult is a null reference (Nothing in Visual Basic).
asyncResult was not returned by a call to the BeginDisconnect method.
was previously called for the asynchronous connection.
An error occurred when attempting to access the socket. See the Remarks section for more information.
The disconnect request has timed out.
completes a call to BeginDisconnect. The method blocks until the disconnect completes. For information about asynchronous operations, see the Asynchronous Programming Overview topic in the MSDN library.
If you receive a SocketException, use the SocketException.ErrorCode property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.
This member outputs trace information when you enable network tracing in your application. For more information, see Network Tracing.
The following code example creates a socket for asynchronous communication and sends some data to a remote host. When the data has been sent, Shutdown is called to stop the send and receive activity. Then BeginDisconnect is called to begin a disconnect request. The callback delegate calls to end the asynchronous request. When the request completes, the Connected property is queried to test whether the socket is disconnected.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.