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

Function server

example/cpp11/echo/blocking_udp_echo_server.cpp:19–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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