InTheHand.Net.NetworkInformation.Ping p = new InTheHand.Net.NetworkInformation.Ping();InTheHand.Net.NetworkInformation.PingReply reply = p.Send("www.google.com");
if (reply.Status == IPStatus.Success){ string message = string.Format("Address: {0}\r\nRoundTrip time: {1}\r\nTime to live: {2}\r\nDon't fragment: {3}\r\nBuffer size: {0}", reply.Address.ToString(), reply.RoundtripTime, reply.Options.Ttl, reply.Options.DontFragment, reply.Buffer.Length); MessageBox.Show(message, "Ping");}else{ MessageBox.Show(reply.Status.ToString(), "Ping");}
The class allows you to further customise the request. You can specify your own data payload for example, or set a different timeout value (the default is 5 seconds).
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.