Example #1
0
        /// <summary>
        /// Moves client to a room
        /// </summary>
        /// <param name="Client">Client object to be moved in a room</param>
        public Room moveClient(Client client)
        {
            if (rooms[rooms.Count - 1].roomSize <= 10)
            {
                rooms[rooms.Count - 1].addClient(client);
            }
            else
            {
                addRoom();
                rooms[rooms.Count - 1].addClient(client);
            }

            return rooms[rooms.Count - 1];
        }
Example #2
0
        /// <summary>
        /// Handles incoming clients
        /// </summary>
        public void ConnHandler()
        {
            //Start listening for connections
            this.TCPLife.Start();

            //Infinite loop
            while (true)
            {
                ///Keeps listening until a client connects
                TcpClient client = this.TCPLife.AcceptTcpClient();

            Client c = new Client(client,rm);
            clients.Add(c);

            Thread newclient = new Thread(new ParameterizedThreadStart(Add));
            newclient.Start(c);

            }
        }
Example #3
0
 public void removeClient(Client client)
 {
     clients.Remove(client);
 }
Example #4
0
 public void addClient(Client client)
 {
     clients.Add(client);
 }