Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
C++ and ping
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Preacher 13
Guest





PostPosted: Fri Apr 12, 2002 8:12 pm    Post subject: C++ and ping Reply with quote

is there a library that I can use to get ping times from withing C++
Back to top
corn
n00b
n00b


Joined: 19 Apr 2002
Posts: 15
Location: Vancouver BC

PostPosted: Fri Apr 19, 2002 6:07 pm    Post subject: Ping Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum