Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     try
     {
         ServerPlayers = new PlayersPool();
         OpenGames     = new GamesPool();
         handler       = new QuerryHandler(ServerPlayers, OpenGames);
         listener      = new TcpListener(IPAddress.Parse(Options.Addres), Options.Port);
         listener.Start();
         Console.WriteLine("Сервер стартовал. Ожидание игроков.");
         while (true)
         {
             TcpClient client = listener.AcceptTcpClient();
             Console.WriteLine("Было подключение");
             Thread clientThread = new Thread(new ParameterizedThreadStart(handler.ClientQuerryHandler));
             clientThread.Start(client);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     finally
     {
         listener?.Stop();
     }
 }
Ejemplo n.º 2
0
 public QuerryHandler(PlayersPool playersPool, GamesPool gamesPool)
 {
     ServerPlayers = playersPool;
     OpenGames     = gamesPool;
 }