Connect the socket to the specified endpoint. * This function is used to connect a socket to the specified remote endpoint. * The function call will block until the connection is successfully made or * an error occurs. * * The socket is automatically opened if it is not already open. If the * connect fails, and the socket was automatically opened, the socket is * not returned to
| 841 | * @endcode |
| 842 | */ |
| 843 | void connect(const endpoint_type& peer_endpoint) |
| 844 | { |
| 845 | asio::error_code ec; |
| 846 | if (!is_open()) |
| 847 | { |
| 848 | impl_.get_service().open(impl_.get_implementation(), |
| 849 | peer_endpoint.protocol(), ec); |
| 850 | asio::detail::throw_error(ec, "connect"); |
| 851 | } |
| 852 | impl_.get_service().connect(impl_.get_implementation(), peer_endpoint, ec); |
| 853 | asio::detail::throw_error(ec, "connect"); |
| 854 | } |
| 855 | |
| 856 | /// Connect the socket to the specified endpoint. |
| 857 | /** |
no test coverage detected