public void Close() { lock (SocketMonitor) { try { StopListeningMessages(); ClientSocket.Close(); } catch (SocketException se) { Trace.WriteLine("SocketException: " + se.ErrorCode + " " + se.Message); } if (ConnectionClosedEvent != null) { ConnectionClosedEvent.Invoke(this, new EventArgs()); } } }
protected virtual void OnConnectionClosed() { ConnectionClosedEvent?.Invoke(this, EventArgs.Empty); }
protected void RaiseEventConnectionClosed() { ConnectionClosedEvent?.Invoke(this, new EventArgs()); }
internal void InternalClose(bool remote = false) { _cancellationTokenSource.Cancel(); ConnectionClosedEvent?.Invoke(this); }
private void NotifyConnectionClosed() { _Logger.Info("Connection was shut down"); ConnectionClosedEvent?.Invoke(this); }