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:
gcc -o echoclient echoclient.c gcc -o echoserver echoserver.c
Run the server:
./echoserver 0.0.0.0 5678 256
Run the client (in this example on the same machine):
./echoclient 127.0.0.1 5678 256 5