MCPcopy Create free account
hub / github.com/boostorg/asio / handle_accept

Method handle_accept

example/cpp11/serialization/server.cpp:64–81  ·  view source on GitHub ↗

Handle completion of a accept operation.

Source from the content-addressed store, hash-verified

62
63 /// Handle completion of a accept operation.
64 void handle_accept(const boost::system::error_code& e, connection_ptr conn)
65 {
66 if (!e)
67 {
68 // Successfully accepted a new connection. Send the list of stocks to the
69 // client. The connection::async_write() function will automatically
70 // serialize the data structure for us.
71 conn->async_write(stocks_,
72 std::bind(&server::handle_write, this,
73 boost::asio::placeholders::error, conn));
74 }
75
76 // Start an accept operation for a new connection.
77 connection_ptr new_conn(new connection(acceptor_.get_executor()));
78 acceptor_.async_accept(new_conn->socket(),
79 std::bind(&server::handle_accept, this,
80 boost::asio::placeholders::error, new_conn));
81 }
82
83 /// Handle completion of a write operation.
84 void handle_write(const boost::system::error_code& e, connection_ptr conn)

Callers

nothing calls this directly

Calls 4

bindFunction · 0.50
async_writeMethod · 0.45
get_executorMethod · 0.45
async_acceptMethod · 0.45

Tested by

no test coverage detected