I am currently having a remote device as a client for sending the object position data and a computer as a server for receiving the data. I would like to check for the latency of the network. With searching for a while I am still confusing about how to achieve that. Could someone give some suggestion?
On the server you could send a [ClientRPC ]to the client’s player. Then when the [ClientRPC] is received on the client it could send a [Command] back to the server. Then on the server compare Time between when the ClientRPC was sent until the Command is received.
There may be a better way, but this should get the job done.
Put a time into the data sent from the client so server will calculate current time (receive time) minus sent time and here you go - the latency.
More general approach:
Create a function like Ping-Pong. Send a ping with current time as data. Client will receive it and send back to the server. So you will have the time span, divide it by 2 and you will get a ping. Make this like 10 times and count the average, or ping the client like every 10 seconds or so and calculate. Store the data separately for each client.
If you’re using the HLAPI, the NetworkClient instance is available under NetworkManager.client. So the RTT would be available under NetworkManager.client.GetRTT()