Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Calculate latency

Author
Message
Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 12th Jul 2010 02:24
Hi, I'm working on a network module and i was wondering how to calculate latency. I need to be able to measure it from the client side.

KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 12th Jul 2010 03:24
Latency from the client perspective.

- Grab the value of the timer and store it
- Send a ping packet to the server
- Have the server do nothing with it, just send it right back
- Compare the difference between the current timer and what was stored

That's the number of milliseconds latency you have round trip from client to server and back.

Do it the opposite way to find the latency from the Server's perspective.

Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 12th Jul 2010 05:42
ok, that seems simple enough. thx

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Jul 2010 15:14
Do it several times for averages and worst-times, and track it during your session too. The Internet is an unpredictable beast and the amount of latency can potentially change drastically within a few minutes.

Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 12th Jul 2010 20:21
Another thing you may want to consider is packet loss if you are using UDP.

The fastest code is the code never written.

Login to post a reply

Server time is: 2026-07-25 07:53:39
Your offset time is: 2026-07-25 07:53:39