asio C++ library

PrevUpHomeNext
basic_socket_acceptor::listen (2 of 2 overloads)

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

void listen(
    int backlog,
    asio::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
asio::ip::tcp::acceptor acceptor(my_context);
...
asio::error_code ec;
acceptor.listen(asio::socket_base::max_listen_connections, ec);
if (ec)
{
  // An error occurred.
}

PrevUpHomeNext