Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
 protected internal void AddConnection(ClientObject clientObject)
 {
     clients.Add(clientObject);
 }
Exemplo n.º 3
0
 protected internal void AddConnection(ClientObject clientObject)
 {
     clients.Add(clientObject);
 }