コード例 #1
0
ファイル: Program.cs プロジェクト: AlexToros/TicTacToe
 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();
     }
 }
コード例 #2
0
 public QuerryHandler(PlayersPool playersPool, GamesPool gamesPool)
 {
     ServerPlayers = playersPool;
     OpenGames     = gamesPool;
 }