示例#1
0
 // 启动服务器
 public void StartServer(string ip, int port)
 {
     AddHandler("chat", OnChat);
     server = new TCPPeer(this);
     server.Listen(ip, port);
     // 启动另一个线程处理消息队列
     this.StartThreadUpdate();
     Console.WriteLine("启动聊天服务器");
 }
示例#2
0
        public void StartServer(string ip, int port)
        {
            AddHandler("chat", OnChat);
            server = new TCPPeer(this);
            server.Listen(ip, port);

            //start the independent myThread to handle message queue
            this.StartThreadUpdate();
            Console.WriteLine("starting chat server");
        }
示例#3
0
 public void StartServer(string ip, int port)
 {
     // 注册事件,本例中只有一个聊天消息
     server = new TCPPeer(this);
     server.Listen(ip, port);
 }