编程语言
首页 > 编程语言> > C#判断IP是否可以ping通

C#判断IP是否可以ping通

作者:互联网

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

 

标签:false,C#,IP,ping,bool,strIP,reply,bRet,Ping
来源: https://www.cnblogs.com/wzf-Learning/p/16224606.html