The ping command returns the RTT of a given host by sending it IMCP ECHO requests[Pos81] which are automatically responded to by the target host. Using this method to measure RTT would be very sensible as then the server does not need to run a special daemon for the purpose. Unfortunately, using ICMP requires the program to access raw sockets that can only be opened by a superuser. This requires the client and server to be setuid root, a dangerous security hole[GM84] and so some other method of measuring the RTT will have to be devised.
The idea of using an ECHO service[Pos83] to measure the RTT came from an example program in chapter 16 of Comer & Stevens[CS96]. A small string of data is sent across the network, the server sends the same data back to the client, and the time this process takes is measured.