0
点赞
收藏
分享

微信扫一扫

C# 设备终端网络是否能ping通

小猪肥 2022-04-21 阅读 118

硬件系统集成中,经常需要查看设备网络是否通,此时就需要我们测试网络

public bool PingIp(string strIP)
        {
            bool bRet = false;
            try
            {
                Ping pingSend = new Ping();
                PingReply reply = pingSend.Send(strIP, 1000);
                if (reply.Status == IPStatus.Success)
                    bRet = true;
            }
            catch (Exception)
            {
                bRet = false;
            }
            return bRet;
        }
举报

相关推荐

0 条评论