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); }
public void Disconnect() { if (this.threadNonStopConnect != null) { this.threadNonStopConnect.Abort(); this.threadNonStopConnect = null; } CtkNetUtil.DisposeTcpClient(this.activeWorkClient); //一旦結束就死了, 需要重new, 所以清掉event沒問題 CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true); }
public virtual void Close() { if (this.host != null) { using (var obj = this.host) { obj.Abort(); obj.Close(); } } CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true);//關閉就代表此類別不用了 }
public void Disconnect() { this.AbortNonStopConnect(); if (this.ChannelFactory != null) { using (var obj = this.ChannelFactory) { obj.Abort(); obj.Close(); } } CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true); }
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); }
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);//關閉就代表此類別不用了 }
void DisposeSelf() { try { this.Disconnect(); } catch (Exception ex) { CtkLog.Write(ex); } CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true); }