Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
basic_stream::connect (5 of 10 overloads)

Establishes a connection by trying each endpoint in a sequence.

Synopsis
template<
    class Iterator>
Iterator
connect(
    Iterator begin,
    Iterator end);
Description

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.

Parameters

Name

Description

begin

An iterator pointing to the start of a sequence of endpoints.

end

An iterator pointing to the end of a sequence of endpoints.

Return Value

An iterator denoting the successfully connected endpoint.

Exceptions

Type

Thrown On

system_error

Thrown on failure. If the sequence is empty, the associated error code is net::error::not_found. Otherwise, contains the error from the last connection attempt.


PrevUpHomeNext