Пример #1
0
 private void ListenStop()
 {
     listener.ListenStop();
     listener = null;
     GC.Collect();
     this.btnStart.Enabled   = true;
     this.btnStop.Enabled    = false;
     this.cmbAddress.Enabled = true;
     this.txtPort.Enabled    = true;
 }
Пример #2
0
        private void ListenStart()
        {
            this.listener      = new AsynSocketListener(this.cmbAddress.Text, Convert.ToInt32(this.txtPort.Text));
            listener.Onread   += new On_read(listener_Onread);
            listener.ShowInfo += new Show_Info(Show_info);

            //监听线程
            Thread tdListen = new Thread(listener.TxtListen);

            tdListen.Name = "tdListen";
            tdListen.Start();
            this.btnStart.Enabled   = false;
            this.btnStop.Enabled    = true;
            this.cmbAddress.Enabled = false;
            this.txtPort.Enabled    = false;
        }