public void Disconnect() { cancelSource.Cancel(); outQueueListener?.Wait(); ThrowIfFail(queueIn.Stop(), queueIn); //ThrowIfFail(queueOut.Stop(), queueOut); commClient.Disconnect(connect); connect = IntPtr.Zero; ThrowIfFail(commClient.Stop()); //queueIn.Dispose(); //queueOut.Dispose(); }