public static void CheckHosts() { foreach (string Host in _OnlineCheckHosts) { if (!WebUtils.Ping(Host, 5000)) { throw new Exception("Failed to ping " + Host); } } throw new Exception("All hosts pingable"); }
public static bool PingNextHosts(int tries) { for (int i = 0; i < tries; i++) { int NextHostIndex = 0; lock (_Lock) { _OnlineCheckIndex = (++_OnlineCheckIndex % _OnlineCheckHosts.Length); NextHostIndex = _OnlineCheckIndex; } if (WebUtils.Ping(_OnlineCheckHosts[NextHostIndex], 5000)) { return(true); } } return(false); }