corn n00b
Joined: 19 Apr 2002 Posts: 15 Location: Vancouver BC
|
Posted: Fri Apr 19, 2002 6:07 pm Post subject: Ping |
|
|
Well there is not really to much to ping. Send a ICMP echo with a timestamp in the header and compare it with the time when it gets back. The porblem with this is that it uses a raw socket and unless you are root or suid your program you cant get one of these dangerous toys. You can download the source for ping and have a look, actually the story of ping is worth a read if you get some time. I guess that no there is no library you can use to get ping times, that I know of.
Another way would be to fork and run ping while piping the stdoutput of ping back to your stdinput. Of course most servers that you would want to find the ping time to, like game servers, have a custom "ping" packet they will respond to. However this has nothing to do with a ICMP ping. |
|