How to

ping IP

Published: 8. January 2009 | Updated: 8. January 2009
License: Microsoft Public License (MS-PL)
Categories: Network
Tags: C# Network
Was this snippet helpful for you? YESYES / NONO

Import namespace

using System.Net.NetworkInformation;

Code

Ping ping = new Ping();
PingReply pingReply = ping.Send("81.2.199.57");

Console.WriteLine("Address: {0}", pingReply.Address);
Console.WriteLine("Time in miliseconds: {0}", pingReply.RoundtripTime);
Console.WriteLine("Status: {0}", pingReply.Status);
Console Output:
Address: 81.2.199.57
Time in miliseconds: 6
Status: Success
Send us feedback about this snippet »



Related Snippets: