Getting a return value from ping
Posted on 2003-02-27
Does anyone know if there's a way of calling a ping and analyzing the results from within your program, other than using "system(ping)", piping the results somewhere, and then parsing the output ?
Basically i need to be able to ping an ip address every n seconds, and then if it is unsucessful, do various things. But i can see no way of calling a ping from within a C program. I'm using window NT so cannot use the ICMP stuff (ie sendecho etc).
So it's like:
//Do a ping somehow...
if (ping was succesful)
//do some other stuff
but how can you get that ping result ?
Thanks a lot...