Socket.DisconnectAsync(SocketAsyncEventArgs) Socket.DisconnectAsync(SocketAsyncEventArgs) Socket.DisconnectAsync(SocketAsyncEventArgs) Socket.DisconnectAsync(SocketAsyncEventArgs) Method

Definition

Begins an asynchronous request to disconnect from a remote endpoint.

public:
 bool DisconnectAsync(System::Net::Sockets::SocketAsyncEventArgs ^ e);
public bool DisconnectAsync (System.Net.Sockets.SocketAsyncEventArgs e);
member this.DisconnectAsync : System.Net.Sockets.SocketAsyncEventArgs -> bool
Public Function DisconnectAsync (e As SocketAsyncEventArgs) As Boolean
Parameters
Returns

Returns true if the I/O operation is pending. The 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 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.

Exceptions

A socket operation was already in progress using the SocketAsyncEventArgs object specified in the e parameter.

An error occurred when attempting to access the socket.

Remarks

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

Applies to

See Also