开发者

How to find the all LAN systems mode using c# whether the system is in log off or hibernate

开发者 https://www.devze.com 2023-02-15 16:25 出处:网络
I am using ip address to find the active state of the machine System.Net.NetworkInformation.Ping p = new System.Net.NetworkInformation.Ping();

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);
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消