private void HandleReportV1(NetworkClient <ReporterClient> client, byte[] data)
        {
            ReportingMessage reportingMessage = new ReportingMessage();

            using (MessageStream.MessageReader mr = new MessageStream.MessageReader(data, false))
            {
                reportingMessage.serverHash      = mr.Read <string>();
                reportingMessage.serverName      = mr.Read <string>();
                reportingMessage.description     = mr.Read <string>();
                reportingMessage.gamePort        = mr.Read <int>();
                reportingMessage.gameAddress     = IPUtils.GetSafeGameAddress(mr.Read <string>(), client.stateObject);
                reportingMessage.protocolVersion = mr.Read <int>();
                reportingMessage.programVersion  = mr.Read <string>();
                reportingMessage.maxPlayers      = mr.Read <int>();
                reportingMessage.modControl      = mr.Read <int>();
                reportingMessage.modControlSha   = mr.Read <string>();
                reportingMessage.gameMode        = mr.Read <int>();
                reportingMessage.cheats          = mr.Read <bool>();
                reportingMessage.warpMode        = mr.Read <int>();
                reportingMessage.universeSize    = mr.Read <long>();
                reportingMessage.banner          = mr.Read <string>();
                reportingMessage.homepage        = mr.Read <string>();
                reportingMessage.httpPort        = mr.Read <int>();
                reportingMessage.admin           = mr.Read <string>();
                reportingMessage.team            = mr.Read <string>();
                reportingMessage.location        = mr.Read <string>();
                reportingMessage.fixedIP         = mr.Read <bool>();
                reportingMessage.players         = mr.Read <string[]>();
            }
            HandleReport(client.stateObject, reportingMessage);
        }
 private void SyncParentLoop()
 {
     if (settings.otherReporters.Count == 0)
     {
         return;
     }
     while (true)
     {
         TcpClient currentConnection = null;
         foreach (string connectString in settings.otherReporters)
         {
             foreach (IPEndPoint endpoint in IPUtils.FindEndpoint(connectString))
             {
                 Console.WriteLine("RELAY CHILD: Connecting to " + endpoint);
                 try
                 {
                     TcpClient    newClient = new TcpClient(endpoint.AddressFamily);
                     IAsyncResult ar        = newClient.BeginConnect(endpoint.Address, endpoint.Port, null, null);
                     if (ar.AsyncWaitHandle.WaitOne(5000))
                     {
                         if (newClient.Connected)
                         {
                             newClient.EndConnect(ar);
                             currentConnection = newClient;
                             break;
                         }
                         else
                         {
                             Console.WriteLine("RELAY CHILD: Connection failed to " + endpoint.Address + " port " + endpoint.Port);
                             newClient.Close();
                         }
                     }
                     else
                     {
                         Console.WriteLine("RELAY CHILD: Connection failed to " + endpoint.Address + " port " + endpoint.Port);
                         newClient.Close();
                     }
                 }
                 catch
                 {
                     Console.WriteLine("RELAY CHILD: Connection failed to " + endpoint.Address + " port " + endpoint.Port);
                 }
             }
             if (currentConnection != null)
             {
                 break;
             }
         }
         if (currentConnection != null)
         {
             Console.WriteLine("RELAY CHILD: Connected!");
             networkClient = new NetworkClient <RelayClient>(networkHandler, currentConnection, false);
             networkClient.TransferToServer(networkServer);
             while (networkClient.Connected)
             {
                 Thread.Sleep(1000);
             }
             Console.WriteLine("RELAY CHILD: Disconnected!");
         }
         else
         {
             Console.WriteLine("RELAY CHILD: All addresses failed. Retrying in 60 sec...!");
         }
         Thread.Sleep(60000);
     }
 }