internal void Listen() { try { listener = new TcpListener(IPAddress.Any, 8000); listener.Start(); Console.WriteLine("Сервер запущен. Ожидание подключений..."); while (true) { TcpClient tcpClient = listener.AcceptTcpClient(); ClientObject clientObject = new ClientObject(tcpClient, this); Thread clientThread = new Thread(new ThreadStart(clientObject.Process)); clientThread.Start(); } } catch(Exception ex) { Console.WriteLine(ex.Message); Disconnect(); } }
internal void RemoveConnection() { if (client != null) client = null; }
internal void AddConnection(ClientObject clientObject) { client = clientObject; }