protected internal void Listen() { try { tcpListener = new TcpListener(IPAddress.Any, 8888); tcpListener.Start(); Console.WriteLine("Server started. Waiting for connections..."); while (true) { TcpClient tcpClient = tcpListener.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(); } }
protected internal void AddConnection(ClientObject clientObject) { clients.Add(clientObject); }