public void createTopic(string topicName)
 {
     TextChatroom newChatroom = new TextChatroom();
     newChatroom.Topic = topicName;
     newChatroom.port = 9001 + Topics.Count();
     Topics.TryAdd(topicName, newChatroom);
     Thread ChatroomThread = new Thread(
         new ThreadStart(
         delegate ()
         {
             Console.WriteLine("....Starting a new chatroom.Port {0}.Name {1}.", newChatroom.port, topicName);
             Uri[] uriArr = { new Uri("net.tcp://localhost:"+ newChatroom.port + "/Chat") };
             ServiceHost host = new ServiceHost(typeof(TextChatroom), uriArr);
             host.Open();
             Console.WriteLine("Host started...");
             Console.ReadKey();
         }));
     ChatroomThread.Start();
 }
Exemple #2
0
        public void createTopic(string topicName)
        {
            TextChatroom newChatroom = new TextChatroom();

            newChatroom.Topic = topicName;
            newChatroom.port  = 9001 + Topics.Count();
            Topics.TryAdd(topicName, newChatroom);
            Thread ChatroomThread = new Thread(
                new ThreadStart(
                    delegate()
            {
                Console.WriteLine("....Starting a new chatroom.Port {0}.Name {1}.", newChatroom.port, topicName);
                Uri[] uriArr     = { new Uri("net.tcp://localhost:" + newChatroom.port + "/Chat") };
                ServiceHost host = new ServiceHost(typeof(TextChatroom), uriArr);
                host.Open();
                Console.WriteLine("Host started...");
                Console.ReadKey();
            }));

            ChatroomThread.Start();
        }