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_socket_acceptor::listen (2 of 2 overloads)

Place the acceptor into the state where it will listen for new connections.

boost::system::error_code listen(
    int backlog,
    boost::system::error_code & ec);

This function puts the socket acceptor into the state where it may accept new connections.

Parameters

backlog

The maximum length of the queue of pending connections.

ec

Set to indicate what error occurred, if any.

Example
boost::asio::ip::tcp::acceptor acceptor(io_service);
...
boost::system::error_code ec;
acceptor.listen(boost::asio::socket_base::max_connections, ec);
if (ec)
{
  // An error occurred.
}

PrevUpHomeNext