Begins an asynchronous request for a remote host connection. The remote host is specified by a host name (string) and a port number (int).
- host
- The name of the remote host.
- port
- The port number of the remote host.
- requestCallback
- An AsyncCallback delegate that references the method to invoke when the operation is complete.
- state
- A user-defined object that contains information about the connect operation. This object is passed to the requestCallback delegate when the operation is complete.
An IAsyncResult object that references the asynchronous connection.
The asynchronous TcpClient.BeginConnect(string, int, AsyncCallback, object) operation must be completed by calling the TcpClient.EndConnect(IAsyncResult) method. Typically, the method is invoked by the asyncCallback delegate.
This method does not block until the operation completes. To block until the operation completes, use one of the erload:System.Net.Sockets.TcpClient.Connect method overloads.
For detailed information about using the asynchronous programming model, see Asynchronous Programming Overview.