Uređivanje

Dijeli putem


TcpClient.EndConnect(IAsyncResult) Method

Definition

Ends a pending asynchronous connection attempt.

public:
 void EndConnect(IAsyncResult ^ asyncResult);
public void EndConnect (IAsyncResult asyncResult);
member this.EndConnect : IAsyncResult -> unit
Public Sub EndConnect (asyncResult As IAsyncResult)

Parameters

asyncResult
IAsyncResult

An IAsyncResult object returned by a call to BeginConnect.

Exceptions

The asyncResult parameter is null.

The asyncResult parameter was not returned by a call to a BeginConnect method.

The EndConnect(IAsyncResult) method was previously called for the asynchronous connection.

An error occurred when attempting to access the Socket.

The underlying Socket has been closed.

Remarks

This method blocks until the operation is complete. To perform this operation synchronously, use a Connect method.

Note

If you receive a SocketException, use SocketException.ErrorCode to obtain the specific error code. After you have obtained this code, you can refer to the Windows Sockets version 2 API error code documentation for a detailed description of the error.

Applies to