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); }
protected override void OnClose() { _receiveThread?.Dispose(); _receiveThread = null; }