Begins an asynchronous request for a remote host connection. The host is specified by an xtd::net::ip_address array and a port number.
- Parameters
-
addresses | At least one xtd::net::ip_address, designating the remote host. |
port | The port number of the remote host. |
callback | An xtd::async_callback delegate that references the method to invoke when the connect 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. |
- Returns
- An xtd::iasync_result that references the asynchronous connection.
- Exceptions
-
- Note
- If you receive a xtd::net::sockets::socket_exception exception, use the xtd::net::sockets::socket_exception::error_code property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.
-
If this socket has previously been disconnected, then xtd::net::sockets::socket::begin_connect must be called on a thread that will not exit until the operation is complete. This is a limitation of the underlying provider. Also the xtd::net::end_point that is used must be different.