C# - Ping command

By , 3/16/2017
(0 ratings)
Simple ping command made in C#
Translate to VB
Console.Write("Enter address to ping -");
string pingstr = Console.ReadLine();
try
{
Ping myPing = new Ping();
PingReply reply = myPing.Send(pingstr, 1000);
if (reply != null)
{
Console.WriteLine("Status: " + reply.Status);
Console.WriteLine("Time: " + reply.RoundtripTime.ToString() + " ms");
Console.WriteLine("Address: " + reply.Address);

}
}
catch
{
Console.WriteLine("Invalid address!");
}
Tagged with ping, c#, command, easy.

Comments

 

Log in, to comment!