Exemple #1
0
        private void Accept(IAsyncResult iar)
        {
            if (this.client_ != null)
            {
                this.client_.Close();
                this.client_ = null;
            }

            this.client_ = this.server_.EndAccept(iar);
            this.ShowMessage("One client access.");
            try
            {
                server_.BeginAccept(new AsyncCallback(Accept), server_);
            }
            catch (System.Exception e)
            {
                this.ShowMessage("Listening port number: " + this.port_ + "  failure.");
            }
            SDKClient.GetInstace().InitConnect(client_);
        }
Exemple #2
0
        private void Accept(IAsyncResult iar)
        {
            if (this.client_ != null)
            {
                this.client_.Close();
                this.client_ = null;
            }

            this.client_ = this.server_.EndAccept(iar);
            this.ShowMessage("一个客户端接入.");
            try
            {
                server_.BeginAccept(new AsyncCallback(Accept), server_);
            }
            catch (System.Exception e)
            {
                this.ShowMessage("监听端口号: " + this.port_ + " 失败.");
            }
            SDKClient.GetInstace().InitConnect(client_);
        }