Using the
Send method of the Ping class (in
System.Net.NetworkInformation namespace) takes the hostname as a parameter. This captures the reply in the
PingReply object, as shown below:
//Code
Ping ping = new Ping();
PingReply reply = ping.Send("www.DevX.com");
To determine whether your ping was successful, use the
Status property of the
PingReply object:
if (reply.Status == IPStatus.Success)
{
//Success
}