I am using ip address to find the active state of the machine
System.Net.NetworkInformation.Ping p = new System.Net.NetworkInformation.Ping();
System.Net.NetworkInformation.PingReply rep = p.Send(ip);
if (rep.Status == Syste开发者_StackOverflow中文版m.Net.NetworkInformation.IPStatus.Success)
You could use this code to check the status..and also explore this site you could get some idea...System.Net.NetworkInformation Namespace
using System.Net.NetworkInformation;
public bool IsNetworkLikelyAvailable()
{
return NetworkInterface
.GetAllNetworkInterfaces()
.Any(x => x.OperationalStatus == OperationalStatus.Up);
}
精彩评论