Exemplo n.º 1
0
 public void Ping(Common.IPv4Address ip, PingSettings settings, PingResultHandler callback)
 {
     for (int i = 0; i < (int)Math.Max(settings.Repeat, 1); i++)
     {
         try
         {
             SendIcmpRequestPacket(ip, settings.Ttl, settings.Bytes, 456, settings.Timeout, callback);
         }
         catch (ARP.IpResolutionFailed arp)
         {
             callback(new PingResult(PingResultType.DestinationHostUnreachable)
             {
                 RespondingHost = _client.Configuration.IpAddress
             });
         }
         System.Threading.Thread.Sleep(settings.Delay);
     }
 }
Exemplo n.º 2
0
 public void Ping(string host, PingSettings settings, PingResultHandler callback)
 {
     Common.IPv4Address ip = _client.Dns.ResolveHost(host).IPs[0];
     Ping(ip, settings, callback);
 }