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.
I tried the dirty trick couple of days ago, but the getLatency
function of GNP requires NetLayers of nodes as parameters, which could
be provided for masterNode, but not for finger because finger was
Is there any hint such that I would be able to get NetLayer of
For the analysing you can also take use of the GlobalOracle. It is not
for productive things, but only for analyzing. There you can get a list
of all hosts in the network and get all components of them, also the
NetLayer. With the Oracle and the ChordContact you can get the NetLayer
for the specific node.