コード例 #1
0
ファイル: TextTopicsManager.cs プロジェクト: HelloItsDev/Chat
 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();
 }
コード例 #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();
        }