Example #1
0
 private bool Ping(string host)
 {
     try
     {
         IPing       myPing      = this._pingFactory.CreateNewPing();
         byte[]      buffer      = new byte[32];
         int         timeout     = 1000;
         PingOptions pingOptions = this._pingFactory.CreateNewPingOptions();
         IPingReply  reply       = myPing.Send(host, timeout, buffer, pingOptions);
         return(reply.Status == IPStatus.Success);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }