...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Establishes a connection by trying each endpoint in a sequence.
template< class EndpointSequence, class ConnectCondition> Protocol::endpoint connect( EndpointSequence const& endpoints, ConnectCondition connect_condition);
This function attempts to connect the stream to one of a sequence of
endpoints by trying each endpoint until a connection is successfully
established. The underlying socket is automatically opened if needed.
An automatically opened socket is not returned to the closed state upon
failure. The algorithm, known as a composed operation,
is implemented in terms of calls to the underlying socket's connect
function.
Name |
Description |
---|---|
|
A sequence of endpoints. |
|
A function object that is called prior to each connection attempt. The signature of the function object must be: bool connect_condition( error_code const& ec, typename Protocol::endpoint const& next);
The |
The successfully connected endpoint.
Type |
Thrown On |
---|---|
|
Thrown on failure. If the sequence is empty, the associated
error code is |