Επεξεργασία

Κοινή χρήση μέσω


TcpListener.EndAcceptTcpClient(IAsyncResult) Method

Definition

Asynchronously accepts an incoming connection attempt and creates a new TcpClient to handle remote host communication.

public:
 System::Net::Sockets::TcpClient ^ EndAcceptTcpClient(IAsyncResult ^ asyncResult);
public System.Net.Sockets.TcpClient EndAcceptTcpClient (IAsyncResult asyncResult);
member this.EndAcceptTcpClient : IAsyncResult -> System.Net.Sockets.TcpClient
Public Function EndAcceptTcpClient (asyncResult As IAsyncResult) As TcpClient

Parameters

asyncResult
IAsyncResult

An IAsyncResult returned by a call to the BeginAcceptTcpClient(AsyncCallback, Object) method.

Returns

A TcpClient.

The TcpClient used to send and receive data.

Remarks

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

Note

You can call the RemoteEndPoint property of the underlying socket (Client) to identify the remote host's network address and port number.

Note

If you receive a SocketException, use the SocketException.ErrorCode property to obtain the specific error code and refer to the Windows Sockets version 2 API error code documentation for a detailed description of the error.

Note

This member outputs trace information when you enable network tracing in your application. For more information, see Network Tracing in the .NET Framework.

Applies to