Begins an asynchronous request for a remote host connection. The remote host is specified by an System.Net.IPAddress array and a port number (int).
- addresses
- At least one System.Net.IPAddress that designates the remote hosts.
- port
- The port number of the remote hosts.
- 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(System.Net.IPAddress, 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.
This method is typically used immediately after a call to the System.Net.Dns.BeginGetHostAddresses(string, AsyncCallback, object) method, which can return multiple IP addresses for a single host.