This sample measures the latency of the transmission channel, and also tests that neither party times out when no application-level messages are sent for a longer period of time.
The program is operated from the command line, and can be invoked using the following syntax:
LatencyTest server tcp|udp <port> LatencyTest client tcp|udp <hostname> <port>
For example:
Start a server in UDP mode, listening in the port 2345.
LatencyTest server udp 2345
Connect as a client to a server running in UDP mode.
LatencyTest client udp 192.168.0.100 2345
When running the test, neither party sends any application-level messages. The low-level protocol layer periodically performs ping communications to keep the connection alive. The RTT is constantly being measured and is outputted on the console window.
The output should look similar to the following:
C:\Users\clb\Desktop\LatencyTest>LatencyTest client udp 192.168.0.100 2345
Connected to 192.168.0.100:2345 (UDP, connected=true, maxSendSize=1400, sock: 192.168.0.22:32052, peer: 192.168.0.100:2345).
Connection Status: ConnectionOK.
OutboundMessagesPending: 1.
InboundPartialBytes: 0.
Connected: true.
Datagram flow Inrate: 105/sec.
Datagram flow Outrate: 75/sec.
Packet loss count: 0.00.
Packet loss rate: 0.00.
Round-Trip Time: 6.76ms.
Ping: 3.38ms.
LastHeardTime: 6.31ms.
Datagrams in: 0.25/sec.
Datagrams out: 0.50/sec.
Messages in: 0.25/sec.
Messages out: 0.50/sec.
Bytes in: 2B/sec.
Bytes out: 4B/sec.
Closed connection to 192.168.0.100:2345 (UDP, connected=true, maxSendSize=1400, sock: 192.168.0.22:32052, peer: 192.168.0.100:2345).
C:\Users\clb\Desktop\LatencyTest>
1.7.1