快速检测网络通断

View Code
System.Net.NetworkInformation.Ping pingSender = new System.Net.NetworkInformation.Ping();
            PingOptions options = new PingOptions();
            options.DontFragment = true;
            string data = "";
            byte[] buffer = Encoding.UTF8.GetBytes(data);
            int timeout = 120;
            PingReply reply = pingSender.Send("192.168.2.202", timeout, buffer, options);
            if (reply.Status == IPStatus.Success)
            {
            }

 

posted @ 2013-03-27 17:36  绿色心情  阅读(321)  评论(0编辑  收藏  举报