It could be as simple as when you issue your ping request. you make note of the current time , and then, when the server/client responds with a pong, you make note of the time again. Subtracting the pong time from the ping time gives you the amount of time for the communication to go between the two applications.