Exemplo n.º 1
0
        private void CloseClientSocket()
        {
            _communicationCountersService?.CommunicationChannels.Decrement();
            _log.Debug($"Closing client socket with IP {RemoteIPAddress}");

            try
            {
                _log.Debug($"Trying shutdown Socket with IP {RemoteIPAddress}");
                _socketReceiveAsyncEventArgs.AcceptSocket.Shutdown(SocketShutdown.Both);
            }
            catch (Exception ex)
            {
                _log.Warning($"Socket shutdown failed for IP {RemoteIPAddress}", ex);
            }

            _isSendProcessing = false;
            _socketReceiveAsyncEventArgs.AcceptSocket?.Close();

            SocketClosedEvent?.Invoke(this, null);
        }
Exemplo n.º 2
0
 protected virtual void OnSocketClosed(USocket us, bool fromRemote)
 {
     SocketClosedEvent?.Invoke(this, new SocketCloseEventArg {
         Socket = us, FromRemote = fromRemote
     });
 }