Home › Forums › PeerfactSim Forum › any idea about latency calculation ? › Reply To: any idea about latency calculation ?
There are several approaches:
You could send a message similar to a PING and remember the timestamp
when it was sent. The contacted node should answer to the PING
directly. As a third step, the PING generating peer receives the PONG
message and compares the current timestamp with the timestamp of PING
generation, thus it obtains the round trip time. The one way latency
is in average half of it.
If you are using GNP as the network layer, you could simply look up
locally the expected delay between those two nodes. GNP is organized
in a way, that a virtual coordinate space is established in which the
distances resemble the latency distance. Please refer to the
documentation of GNP with regard to which methods to call.