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

Method do_write

example/cpp11/http/server3/connection.cpp:66–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66void connection::do_write()
67{
68 auto self(shared_from_this());
69 boost::asio::async_write(socket_, reply_.to_buffers(),
70 [this, self](boost::system::error_code ec, std::size_t)
71 {
72 if (!ec)
73 {
74 // Initiate graceful connection closure.
75 boost::system::error_code ignored_ec;
76 socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both,
77 ignored_ec);
78 }
79
80 // No new asynchronous operations are started. This means that
81 // all shared_ptr references to the connection object will
82 // disappear and the object will be destroyed automatically after
83 // this handler returns. The connection class's destructor closes
84 // the socket.
85 });
86}
87
88} // namespace server3
89} // namespace http

Callers

nothing calls this directly

Calls 3

async_writeFunction · 0.85
to_buffersMethod · 0.45
shutdownMethod · 0.45

Tested by

no test coverage detected