System.Net.Sockets.Socket.DisconnectAsync Method

Begins an asynchronous request to disconnect from a remote endpoint.

Syntax

public bool DisconnectAsync (SocketAsyncEventArgs e)

Parameters

e
The System.Net.Sockets.SocketAsyncEventArgs object to use for this asynchronous socket operation.

Returns

Returns true if the I/O operation is pending. The SocketAsyncEventArgs.Completed event on the e parameter will be raised upon completion of the operation.

Returns false if the I/O operation completed synchronously. In this case, The SocketAsyncEventArgs.Completed event on the e parameter will not be raised and the e object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the operation.

Remarks

When using a connection-oriented protocol, calling the Socket.DisconnectAsync(SocketAsyncEventArgs) method requests a disconnect from a remote endpoint. If you set SocketAsyncEventArgs.DisconnectReuseSocket to true in the e parameter, the socket can be reused.

Requirements

Namespace: System.Net.Sockets
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0