boost::corosio::tcp_server::start

Start accepting connections.

Synopsis

void
start();

Description

Launches accept loops for all bound endpoints. Incoming connections are dispatched to idle workers from the pool.

Calling start() on an already‐running server has no effect.

Preconditions

‐ At least one endpoint bound via bind. ‐ Workers provided to the constructor. ‐ If restarting, join must have completed first.

Effects

Creates one accept coroutine per bound endpoint. Each coroutine runs on the server's executor, waiting for connections and dispatching them to idle workers.

Restart Sequence

To restart after stopping, complete the full shutdown cycle:

srv.start();
ioc.run_for( 1s );
srv.stop();       // 1. Signal shutdown
ioc.run();        // 2. Drain remaining completions
srv.join();       // 3. Wait for accept loops

// Now safe to restart
srv.start();
ioc.run();

Thread Safety

Not thread safe.

Exceptions

Name

Thrown on

std::logic_error

If a previous session has not been joined (accept loops still active).

Created with MrDocs