TraceRoute and Ping in C#

.net, c#, networking, ping, traceroute

Solution

Although the Base Class Library includes Ping, the BCL does not include any tracert functionality.

However, a quick search reveals two open-source attempts, the first in C# the second in C++:

- http://www.codeproject.com/KB/IP/tracert.aspx

- http://www.codeguru.com/Cpp/I-N/network/basicnetworkoperations/article.php/c5457/

Problem

Does anyone have C# code handy for doing a ping and traceroute to a target computer? I am looking for a pure code solution, not what I'm doing now, which is invoking the ping.exe and tracert.exe program and parsing the output. I would like something more robust.

Original source