Download, compile and run at your own risk:
The echo client sends a number of UDP packets to the server and waits for the answer (an echo message). It will show how long the echo took from client to server and back.
Compile the programs:
Run the server:
Run the client (in this example on the same machine):