private Boolean Ping()
{
 PingOptions options = new PingOptions();
 options.DontFragment = true;
 options.Ttl = 128;

 string _32Chars = "12345678123456781234567812345678";
 byte[] _32BytesBuf = Encoding.ASCII.GetBytes(_32Chars);

 PingReply reply = null;
 try
 {
  Ping pingSender = new Ping();
  reply = pingSender.Send(strAddress, nTimeOut, _32BytesBuf, options);
 }
 catch (Exception ex)
 {
  Debug.WriteLine("[" + ex.Message + "]");
  return false;
 }

 return reply.Status == IPStatus.Success;
}

 


本文链接地址: C#中Ping类的使用
https://blog.qingfengju.com/index.asp?id=306

上一篇: 通过wifi使用adb连接手机
下一篇: 在CoLinux上安装debian-squeeze,启动时在如下步骤停留时间过长:

分类:Win32/C++ 查看次数:11327 发布时间:2011/12/19 0:53:34