2

I have been tasked with verifying the connectivity between various devices that I can't query directly. The way the C programmers did it in the past was to create a batch file with lines like:

ping -n 5 -S [Source Address] [Destination Address] >> OutputFile.txt

Then they run the batch file and open the output file and parse the results to find out if it worked.

In C# I know I can simply write:

Ping pinger = new Ping(); PingReply reply = pinger.Send(DestinationAddress);

and check reply.Status for IPStatus.Success

But this does not specify the source address. I have searched but I haven't been able to find a way to do anything like the command line shown above in C#. Is there no new and better way than this old kluge?

user1585674
  • 31
  • 1
  • 2

0 Answers0