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

Function test_callback

example/cpp14/operations/composed_2.cpp:126–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124//------------------------------------------------------------------------------
125
126void test_callback()
127{
128 boost::asio::io_context io_context;
129
130 tcp::acceptor acceptor(io_context, {tcp::v4(), 55555});
131 tcp::socket socket = acceptor.accept();
132
133 // Test our asynchronous operation using a lambda as a callback.
134 async_write_message(socket, "Testing callback\r\n", false,
135 [](const boost::system::error_code& error, std::size_t n)
136 {
137 if (!error)
138 {
139 std::cout << n << " bytes transferred\n";
140 }
141 else
142 {
143 std::cout << "Error: " << error.message() << "\n";
144 }
145 });
146
147 io_context.run();
148}
149
150//------------------------------------------------------------------------------
151

Callers 1

mainFunction · 0.70

Calls 3

async_write_messageFunction · 0.70
acceptMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected