### connect

The `connect` function is a composed operation that establishes a socket connection by trying each endpoint in a sequence.

Establishes a socket connection by trying each endpoint in a sequence.

    template<
        typename Protocol,
        typename Executor,
        typename EndpointSequence>
    Protocol::endpoint connect(
        basic_socket< Protocol, Executor > & s,
        const EndpointSequence & endpoints,
        constraint_t< is_endpoint_sequence< EndpointSequence >::value >  = 0);
      » more...

    template<
        typename Protocol,
        typename Executor,
        typename EndpointSequence>
    Protocol::endpoint connect(
        basic_socket< Protocol, Executor > & s,
        const EndpointSequence & endpoints,
        asio::error_code & ec,
        constraint_t< is_endpoint_sequence< EndpointSequence >::value >  = 0);
      » more...

(Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence.

    template<
        typename Protocol,
        typename Executor,
        typename Iterator>
    Iterator connect(
        basic_socket< Protocol, Executor > & s,
        Iterator begin,
        constraint_t<!is_endpoint_sequence< Iterator >::value >  = 0);
      » more...

    template<
        typename Protocol,
        typename Executor,
        typename Iterator>
    Iterator connect(
        basic_socket< Protocol, Executor > & s,
        Iterator begin,
        asio::error_code & ec,
        constraint_t<!is_endpoint_sequence< Iterator >::value >  = 0);
      » more...

Establishes a socket connection by trying each endpoint in a sequence.

    template<
        typename Protocol,
        typename Executor,
        typename Iterator>
    Iterator connect(
        basic_socket< Protocol, Executor > & s,
        Iterator begin,
        Iterator end);
      » more...

    template<
        typename Protocol,
        typename Executor,
        typename Iterator>
    Iterator connect(
        basic_socket< Protocol, Executor > & s,
        Iterator begin,
        Iterator end,
        asio::error_code & ec);
      » more...

    template<
        typename Protocol,
        typename Executor,
        typename EndpointSequence,
        typename ConnectCondition>
    Protocol::endpoint connect(
        basic_socket< Protocol, Executor > & s,
        const EndpointSequence & endpoints,
        ConnectCondition connect_condition,
        constraint_t< is_endpoint_sequence< EndpointSequence >::value >  = 0);
      » more...

    template<
        typename Protocol,
        typename Executor,
        typename EndpointSequence,
        typename ConnectCondition>
    Protocol::endpoint connect(
        basic_socket< Protocol, Executor > & s,
        const EndpointSequence & endpoints,
        ConnectCondition connect_condition,
        asio::error_code & ec,
        constraint_t< is_endpoint_sequence< EndpointSequence >::value >  = 0);
      » more...

(Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence.

    template<
        typename Protocol,
        typename Executor,
        typename Iterator,
        typename ConnectCondition>
    Iterator connect(
        basic_socket< Protocol, Executor > & s,
        Iterator begin,
        ConnectCondition connect_condition,
        constraint_t<!is_endpoint_sequence< Iterator >::value >  = 0);
      » more...

    template<
        typename Protocol,
        typename Executor,
        typename Iterator,
        typename ConnectCondition>
    Iterator connect(
        basic_socket< Protocol, Executor > & s,
        Iterator begin,
        ConnectCondition connect_condition,
        asio::error_code & ec,
        constraint_t<!is_endpoint_sequence< Iterator >::value >  = 0);
      » more...

Establishes a socket connection by trying each endpoint in a sequence.

    template<
        typename Protocol,
        typename Executor,
        typename Iterator,
        typename ConnectCondition>
    Iterator connect(
        basic_socket< Protocol, Executor > & s,
        Iterator begin,
        Iterator end,
        ConnectCondition connect_condition);
      » more...

    template<
        typename Protocol,
        typename Executor,
        typename Iterator,
        typename ConnectCondition>
    Iterator connect(
        basic_socket< Protocol, Executor > & s,
        Iterator begin,
        Iterator end,
        ConnectCondition connect_condition,
        asio::error_code & ec);
      » more...

##### Requirements

Header: `asio/impl/connect.hpp`

Convenience header: `asio.hpp`