a minimal UDP echo test (client and server), written in C++
client and server are implemented in the same executable.
the actual role (client or server) is decided by the subcommand.
both client and server have the same optional CLI arguments:
udp-echo-test server --addr 0.0.0.0 --port 5000
udp-echo-test client --addr 0.0.0.0 --port 5000
both server and client bind to the specified address (default 0.0.0.0) and port (default 5000)
the server waits for requests, and sends the received data back to the client = "echo"
the client connects to the server, and sends random data to the server (every second)
and waits for the server's response (timeout 10 seconds)
and then verifies that the response data is equal to the request data ("echo")
the client has additional optional CLI arguments:
udp-echo-test client --addr 0.0.0.0 --port 5000 --timeout 30 --interval 1 --count 10
"count" is the number of requests sent to the server. default is 0 = infinite number of requests
- using the Boost.Asio library
- src/boost-sync - using the synchronous UDP methods
socket.send_toandsocket.receive_from - src/boost-async - using the asynchronous UDP methods
socket.async_send_toandsocket.async_receive_from
- src/boost-sync - using the synchronous UDP methods
- use the photon library (benchmarks)