예제 #1
0
파일: AmIOnline.cs 프로젝트: Samotron/RMLib
 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");
 }
예제 #2
0
파일: AmIOnline.cs 프로젝트: Samotron/RMLib
        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);
        }