コード例 #1
0
        public void Disconnect()
        {
            if (this.threadNonStopConnect != null)
            {
                this.threadNonStopConnect.Abort();
            }

            foreach (var tc in this.TcpClientList)
            {
                if (tc == null)
                {
                    continue;
                }
                try { tc.Close(); }
                catch (Exception ex) { CtkLog.Write(ex); }
            }

            if (this.m_tcpListener != null)
            {
                this.m_tcpListener.Stop();
            }

            //一旦結束就死了, 需要重new, 所以清掉event沒問題
            CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true);
        }
コード例 #2
0
        public void Disconnect()
        {
            if (this.threadNonStopConnect != null)
            {
                this.threadNonStopConnect.Abort();
                this.threadNonStopConnect = null;
            }
            CtkNetUtil.DisposeTcpClient(this.activeWorkClient);

            //一旦結束就死了, 需要重new, 所以清掉event沒問題
            CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true);
        }
コード例 #3
0
        public virtual void Close()
        {
            if (this.host != null)
            {
                using (var obj = this.host)
                {
                    obj.Abort();
                    obj.Close();
                }
            }

            CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true);//關閉就代表此類別不用了
        }
コード例 #4
0
        public void Disconnect()
        {
            this.AbortNonStopConnect();
            if (this.ChannelFactory != null)
            {
                using (var obj = this.ChannelFactory)
                {
                    obj.Abort();
                    obj.Close();
                }
            }

            CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true);
        }
コード例 #5
0
        public void Disconnect()
        {
            if (this.threadNonStopConnect != null)
            {
                this.threadNonStopConnect.Abort();
            }
            if (this.serialPort != null)
            {
                this.serialPort.Close();
                this.serialPort.Dispose();
            }

            //一旦結束就死了, 需要重new, 所以清掉event沒問題
            CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true);
        }
コード例 #6
0
        public virtual void Close()
        {
            foreach (var chinfo in this.channelMapper)
            {
                var ch = chinfo.Value.Channel;
                ch.Abort();
                ch.Close();
            }

            if (this.host != null)
            {
                using (var obj = this.host)
                {
                    obj.Abort();
                    obj.Close();
                }
            }

            CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true);//關閉就代表此類別不用了
        }
コード例 #7
0
 void DisposeSelf()
 {
     try { this.Disconnect(); }
     catch (Exception ex) { CtkLog.Write(ex); }
     CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true);
 }