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

Function server

example/cpp14/echo/blocking_udp_echo_server.cpp:20–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18enum { max_length = 1024 };
19
20void server(boost::asio::io_context& io_context, unsigned short port)
21{
22 udp::socket sock(io_context, udp::endpoint(udp::v4(), port));
23 for (;;)
24 {
25 char data[max_length];
26 udp::endpoint sender_endpoint;
27 size_t length = sock.receive_from(
28 boost::asio::buffer(data, max_length), sender_endpoint);
29 sock.send_to(boost::asio::buffer(data, length), sender_endpoint);
30 }
31}
32
33int main(int argc, char* argv[])
34{

Callers 1

mainFunction · 0.70

Calls 4

bufferFunction · 0.85
endpointClass · 0.50
receive_fromMethod · 0.45
send_toMethod · 0.45

Tested by

no test coverage detected