Ping , How should it be done ?

Hi all!
I need to make a program which pings a target and gets timeout value for each request.This program will be used on Windows computers.
I guess there're two ways ,
1st to use Windows ping tool and decompose output.
2nd to make own ping tool,

Is there any other way ?
Which one is easier ?

Thanks in advance,


I guess both of ways have drawbacks,
If it's decided to make by using Windows ping tool , language will be problem.Because result of windows ping tool changes when language of operating system changes.
If it's decided to make own ping tool , it seems quite difficult and complex with no socket programming knowledge.
Here you will find an C++ example of ping. They use a variant with raw sockets.

http://tangentsoft.net/wskfaq/examples/rawping.html

In Windows you still have the choice to use the ICMP.dll. With this dll the code will be much shorter (3 times so short). But its less powerfull, in its nature, because with raw sockets you have absolute control over all content.

Microsoft claims since Win98 to remove ICMP.dll, but it is still in Win7. So it will work like this, but not sure how it will be in future. The raw socket method will always work.

Hope it helped,
Maikel

PS: you will find all information at the linked page i gave you here
Last edited on
In my opinion, you should not rely on the output of ping, since you have no guarantee that it won't change between different versions of Windows, even between different service packs. And there is the language problem that you already mentioned.

Programming your own ping tool can be a bit complex if you use low level socket programming. However, there is a function in the Win32 API that does (almost) everything for you:
http://msdn.microsoft.com/en-us/library/aa366050%28VS.85%29.aspx


Last edited on
Thanks for answers,
IcmpSendEcho Function seems quite useful.
Last edited on
Topic archived. No new replies allowed.