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());
                }
            }
        }
Exemple #2
0
 protected virtual void OnConnectionClosed()
 {
     ConnectionClosedEvent?.Invoke(this, EventArgs.Empty);
 }
Exemple #3
0
 protected void RaiseEventConnectionClosed()
 {
     ConnectionClosedEvent?.Invoke(this, new EventArgs());
 }
Exemple #4
0
 internal void InternalClose(bool remote = false)
 {
     _cancellationTokenSource.Cancel();
     ConnectionClosedEvent?.Invoke(this);
 }
Exemple #5
0
 private void NotifyConnectionClosed()
 {
     _Logger.Info("Connection was shut down");
     ConnectionClosedEvent?.Invoke(this);
 }