🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Getting ping time

Started by
0 comments, last by Pretender 23 years, 1 month ago
Is there a simple way to find out the ping time to a remote computer, perhaps an API somewhere that I''ve missed? I''m not completely new to multiplayer programming, but I don''t quite know how to go about pinging.
Advertisement
send a packet from the client to the server.
As soon as the server receives the packet, immediately send one back to the client. Have the client measure the tiem between when it sent its packet to when it received a packet back from the server. And that is your roundtrip time. You can divide this by 2 to ESTIMATE the one way time. But the time from the client to the server is probably not going to be the same as the time from the server to the client. Because things just dont always take the same amount of time, that is just the nature of the net. It shouldnt vary much though. So dividing it by 2 should give you a good approximation.

"I pity the fool, thug, or soul who tries to take over the world, then goes home crying to his momma."
- Mr. T

This topic is closed to new replies.

Advertisement