TcpClient.EndConnect(IAsyncResult) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.