Link to home
Start Free TrialLog in
Avatar of pcvii
pcvii

asked on

ping for client and server

I'm writing a lobby client and server system. for hosting games and stuff. I want the client to know how good their ping is to the server. or to the games being hosted.

I'm using SDL and SDLnet. I was thinking of using time. But I was unsure of how to do that because my clients could be in another time zone or have their computers just with different times on them.

I'm coding in visual studio 2005 express.
Avatar of jkr
jkr
Flag of Germany image

Just use http://www.codeproject.com/internet/winping.asp - the time zones should not matter, since the respose times should be seconds in the worst case.
Avatar of wayside
wayside

That project uses raw sockets to do the ping. This is not reliable because the latest Microsoft OS's can deny access to raw sockets depending on your privileges.

Better is to use the IcmpSendEcho function as shown here: http://msdn2.microsoft.com/en-us/library/aa366050.aspx

This will work no matter what your privileges.
If you want more information on the ping status try WMI class
Win32_PingStatus Class
Best Regards,
DeepuAbrahamK
Avatar of pcvii

ASKER

ok i like some of the info

any ideas how i could use the tcp connection thats already established?
ASKER CERTIFIED SOLUTION
Avatar of jgordos
jgordos
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial