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

Function main

example/cpp11/tutorial/daytime2/server.cpp:25–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25int main()
26{
27 try
28 {
29 boost::asio::io_context io_context;
30
31 tcp::acceptor acceptor(io_context, tcp::endpoint(tcp::v4(), 13));
32
33 for (;;)
34 {
35 tcp::socket socket(io_context);
36 acceptor.accept(socket);
37
38 std::string message = make_daytime_string();
39
40 boost::system::error_code ignored_error;
41 boost::asio::write(socket, boost::asio::buffer(message), ignored_error);
42 }
43 }
44 catch (std::exception& e)
45 {
46 std::cerr << e.what() << std::endl;
47 }
48
49 return 0;
50}

Callers

nothing calls this directly

Calls 5

writeFunction · 0.85
bufferFunction · 0.85
make_daytime_stringFunction · 0.70
endpointClass · 0.50
acceptMethod · 0.45

Tested by

no test coverage detected