Search Unity

[ANSWERED]How to determine the latency of a single message

Discussion in 'Multiplayer' started by rob_vld, Oct 8, 2015.

  1. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    NetworkTransport.GetCurrentRtt
    - returns an average latency measured over several received messages.

    NetworkTransport.GetRemoteDelayTimeMS
    - returns the elapsed time since last received message.

    How do i get the elapsed time between the actual message creation and message process? ( half round trip )
     
  2. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    1. Using GetNetworkTimestamp will return you timestamp value.
    2. Add this timestamp to message as one of the message field
    3. When you will receive message use GetRemoteDelayTimeMS and provide receiving timestamp as parameter.
    The last call will return you delay between GetNetworkTimestamp() call (from 1 step) and moment when you call GetRemoteDelayTimeMS()

    it is exactly what you want (if I understand you correct)
     
  3. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    Yes, perfect
    thanks :)