template<class Protocol, class EndpointSequence>
typename Protocol::endpoint connect(basic_socket<Protocol>& s,
const EndpointSequence& endpoints);
template<class Protocol, class EndpointSequence>
typename Protocol::endpoint connect(basic_socket<Protocol>& s,
const EndpointSequence& endpoints,
error_code& ec);
Returns: connect(s, endpoints, [](auto, auto){ return true; }, ec).
template<class Protocol, class EndpointSequence, class ConnectCondition>
typename Protocol::endpoint connect(basic_socket<Protocol>& s,
const EndpointSequence& endpoints,
ConnectCondition c);
template<class Protocol, class EndpointSequence, class ConnectCondition>
typename Protocol::endpoint connect(basic_socket<Protocol>& s,
const EndpointSequence& endpoints,
ConnectCondition c, error_code& ec);
Returns: typename Protocol::endpoint() if no such element is found, otherwise ep.
Error conditions:
socket_errc::not_found — if endpoints.empty() or if the function object c returned false for all elements in the sequence.
template<class Protocol, class InputIterator>
InputIterator connect(basic_socket<Protocol>& s,
InputIterator first, InputIterator last);
template<class Protocol, class InputIterator>
InputIterator connect(basic_socket<Protocol>& s,
InputIterator first, InputIterator last,
error_code& ec);
Returns: connect(s, first, last, [](auto, auto){ return true; }, ec).
template<class Protocol, class InputIterator, class ConnectCondition>
InputIterator connect(basic_socket<Protocol>& s,
InputIterator first, InputIterator last,
ConnectCondition c);
template<class Protocol, class InputIterator, class ConnectCondition>
InputIterator connect(basic_socket<Protocol>& s,
InputIterator first, InputIterator last,
ConnectCondition c, error_code& ec);
Returns: last if no such iterator is found, otherwise i.
template<class Protocol, class EndpointSequence, class CompletionToken>
DEDUCED async_connect(basic_socket<Protocol>& s,
const EndpointSequence& endpoints,
CompletionToken&& token);
Returns:
async_connect(s, endpoints, [](auto, auto){ return true; }, forward<CompletionToken>(token))
template<class Protocol, class EndpointSequence,
class ConnectCondition, class CompletionToken>
DEDUCED async_connect(basic_socket<Protocol>& s,
const EndpointSequence& endpoints,
ConnectCondition c,
CompletionToken&& token);
A composed asynchronous operation ([async.reqmts.async.composed]).
Completion signature: void(error_code ec, typename Protocol::endpoint ep).
ec is updated with the result of the s.async_connect(ep, unspecified) operation, if any. If no such element is found, or if the operation fails with one of the error conditions listed below, ep is set to typename Protocol::endpoint(). [ Note: The underlying close, open, and async_connect operations are performed sequentially. — end note ]
template<class Protocol, class InputIterator, class CompletionToken>
DEDUCED async_connect(basic_socket<Protocol>& s,
InputIterator first, InputIterator last,
CompletionToken&& token);
Returns:
async_connect(s, first, last, [](auto, auto){ return true; }, forward<CompletionToken>(token))
template<class Protocol, class InputIterator,
class ConnectCondition, class CompletionToken>
DEDUCED async_connect(basic_socket<Protocol>& s,
InputIterator first, InputIterator last,
ConnectCondition c,
CompletionToken&& token);
A composed asynchronous operation ([async.reqmts.async.composed]).
Completion signature: void(error_code ec, InputIterator i).
Effects: Performs ec.clear(), then finds the first iterator i in the range [first, last) for which:
c(ec, *i) yields true;
s.close(ec) succeeds;
s.open(typename Protocol::endpoint(*i).protocol(), ec) succeeds; and
the asynchronous operation s.async_connect(*i, unspecified) succeeds.
ec is updated with the result of the s.async_connect(*i, unspecified) operation, if any. If no such iterator is found, or if the operation fails with one of the error conditions listed below, i is set to last. [ Note: The underlying close, open, and async_connect operations are performed sequentially. — end note ]