Exemple #1
0
 public static void PingServer(object o)
 {
     var serverAddressAndPort = (string[])o;
     var serverAddress = serverAddressAndPort[0];
     var serverPort = Convert.ToInt32(serverAddressAndPort[1]);
     Server server = new Server(serverAddress, serverPort);
     var isActive = server.Ping();
     var result = activeServers.Find(item => item.port == server.port);
     if (isActive && result == null)
     {
         activeServers.Add(server);
     }
     else if (!isActive && result != null)
     {
         activeServers.Remove(result);
     }
 }