Name space: using System.Net.NetworkInformation;
try
{
Ping oping = new Ping();
PingReply oReply = oping.Send(machineipaddress);
if (oReply.Status.ToString().ToLower() != "success")
{
MessageBox.Show("Unable to ping the machine " + machineipaddress + "\n\n\t" + oReply.Status);
Environment.Exit(0);
}
}
catch (PingException ex)
{
MessageBox.Show("Error while pinging the machine " + machineipaddress + "\n\n" + ex.Message);
Environment.Exit(0);
}
try
{
Ping oping = new Ping();
PingReply oReply = oping.Send(machineipaddress);
if (oReply.Status.ToString().ToLower() != "success")
{
MessageBox.Show("Unable to ping the machine " + machineipaddress + "\n\n\t" + oReply.Status);
Environment.Exit(0);
}
}
catch (PingException ex)
{
MessageBox.Show("Error while pinging the machine " + machineipaddress + "\n\n" + ex.Message);
Environment.Exit(0);
}
1 comments:
Nalla irruku but include the namespace while posting codes
Post a Comment