码迷,mamicode.com
首页 > Windows程序 > 详细

C# Ping Ip地址

时间:2017-06-15 18:51:43      阅读:265      评论:0      收藏:0      [点我收藏+]

标签:bsp   end   grep   style   send   ring   als   color   pst   

        /// <summary>
        /// ping ip,测试能否ping通
        /// </summary>
        /// <param name="strIP">IP地址</param>
        /// <returns></returns>
        private 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;
        }

 

  

C# Ping Ip地址

标签:bsp   end   grep   style   send   ring   als   color   pst   

原文地址:http://www.cnblogs.com/zhangfeng1993/p/7019390.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!