Example #1
0
 /// <summary>
 /// Start the server.
 /// </summary>
 public void Start()
 {
     while (true)
     {
         TcpClient    tcpClient    = listener.AcceptTcpClient();
         ClientThread clientThread = new ClientThread(tcpClient, hub);
         clientThread.StartClientThread();
         hub.AddClient(clientThread);
     }
 }
Example #2
0
 /// <summary>
 /// Create a new room, only happens if the room does not already exists.
 /// </summary>
 /// <param name="clientThread"></param>
 /// <param name="currentRoom"></param>
 /// <param name="name"></param>
 public void CreateRoom(ClientThread clientThread, Room currentRoom, string name)
 {
     if (!RoomExists(name))
     {
         currentRoom.RemoveClient(clientThread);
         Room room = new Room(this, name);
         room.AddClient(clientThread);
         rooms.Add(room);
         clientThread.JoinRoom(room);
     }
 }