// /** // * File: ICMP.cs // * Author: haraldwolff // * // * This file and it's content is copyrighted by the Author and / or copyright holder. // * Any use wihtout proper permission is illegal and may lead to legal actions. // * // * // **/ using System; using System.Net.NetworkInformation; namespace ln.skyscanner.crawl.tests { public static class ICMP { public static bool IsReachable(CrawledHost crawledHost) { return true; //using (Ping ping = new Ping()) //{ // HostCrawl.setState("ICMP check"); // int nSuccess = 0; // long roundTripTime = 0; // for (int n = 0; n < 10; n++) // { // HostCrawl.setState("ICMP check [{0}/10]", n); // PingReply pingReply = ping.Send(CrawledHost.PrimaryIP, 500); // if (pingReply.Status == IPStatus.Success) // { // nSuccess++; // roundTripTime += pingReply.RoundtripTime; // } // else if ((n > 3) && (nSuccess == 0)) // { // break; // } // } // if (nSuccess > 0) // { // roundTripTime /= nSuccess; // CrawledHost.SetHint("ping.success", true); // CrawledHost.SetHint("ping.rta", (int)roundTripTime); // CrawledHost.SetHint("ping.out_of_ten", nSuccess); // } // else // { // CrawledHost.SetHint("ping.success", false); // CrawledHost.SetHint("ping.rta", null); // CrawledHost.SetHint("ping.out_of_ten", 0); // } // return CrawledHost.GetHint("ping.success"); //} } } }