public void Process()
 {
     try
     {
         Console.WriteLine("{0}: Подключился.", _clientIp);
         while (true)
         {
             try
             {
                 var stream = _client.GetStream();
                 var input  = NetManager.Receive(_client, stream);
                 CommandManager.CommandHandler(stream, input, _clientIp);
             }
             catch (Exception)
             {
                 Console.WriteLine("{0}: Отключился.", _clientIp);
                 break;
             }
         }
     }
     catch (Exception ex)
     {
         ExceptManager.Write(ex);
     }
     finally
     {
         NetManager.Disconnect(_client);
     }
 }
        private static void Main()
        {
            try
            {
                _listener = new TcpListener(IPAddress.Any, Port);
                _listener.Start();
                Console.WriteLine("Ожидание подключений...");

                while (true)
                {
                    var client       = _listener.AcceptTcpClient();
                    var clientObject = new СlientObject(client);

                    var clientThread = new Thread(clientObject.Process);
                    clientThread.Start();
                }
            }
            catch (Exception ex)
            {
                ExceptManager.Write(ex);
            }
            finally
            {
                _listener?.Stop();
            }
        }