示例#1
0
        public void Close()
        {
            if (!IsOpen)
            {
                throw new InvalidOperationException("Cannot close, is not open");
            }

            _reconnectThread.Dispose();
            _reconnectThread = null;

            OnClose();

            CloseSocket();

            IsOpen      = false;
            IsConnected = false;

            Log.Debug("Socket connected to {HostName}:{Port} has been closed", _hostName, _port);
        }
示例#2
0
 protected override void OnClose()
 {
     _receiveThread?.Dispose();
     _receiveThread = null;
 }