Example #1
0
        private void ListenForClients()
        {
            try
            {
                PerformaceCounters.Instance.ListenerCounterIncrement();
                LogHelper.LogMessage(string.Format("Listening for incoming connections on port {0}.", PublicPortRequested), Issue.IssueLevel.Information);

                while (this._state == PortListenerState.Running)
                {
                    var tcpClientActor = _tcpListener.WaitForTcpClient();

                    if (tcpClientActor != null)
                    {
                        var tcpActor = new TcpActor(tcpClientActor, _redirectRules);
                        _tcpActors.Add(tcpActor);
                        tcpActor.Start();
                    }
                }
            }
            catch (Exception exp)
            {
                if (_tcpListener != null && _tcpListener.LocalEndpoint != null)
                {
                    exp.Data.Add("Address", _tcpListener.LocalEndpoint.Address);
                    exp.Data.Add("Address", _tcpListener.LocalEndpoint.Port);
                }

                LogHelper.LogException(exp, false, LogHelper.ExceptionSeverity.ErrorException);
            }
            finally
            {
                PerformaceCounters.Instance.ListenerCounterDecrement();
                LogHelper.LogMessage(string.Format("Listener with port {0} has terminated.", PublicPortRequested), Issue.IssueLevel.Information);
            }
        }
 void TcpActor_TcpActorStoppedEvent(object sender, TcpActor.TcpActorStoppedEventArgs e)
 {
     _tcpActors.Remove(e.TcpActor);
 }
        private void ListenForClients()
        {
            try
            {
                PerformaceCounters.Instance.ListenerCounterIncrement();
                LogHelper.LogMessage(string.Format("Listening for incoming connections on port {0}.", PublicPortRequested), Issue.IssueLevel.Information);

                while (this._state == PortListenerState.Running)
                {
                    var tcpClientActor = _tcpListener.WaitForTcpClient();

                    if (tcpClientActor != null)
                    {
                        var tcpActor = new TcpActor(tcpClientActor, _redirectRules);
                        _tcpActors.Add(tcpActor);
                        tcpActor.Start();
                    }
                }
            }
            catch (Exception exp)
            {
                if (_tcpListener != null && _tcpListener.LocalEndpoint != null)
                {
                    exp.Data.Add("Address", _tcpListener.LocalEndpoint.Address);
                    exp.Data.Add("Address", _tcpListener.LocalEndpoint.Port);
                }

                LogHelper.LogException(exp, false, LogHelper.ExceptionSeverity.ErrorException);
            }
            finally
            {
                PerformaceCounters.Instance.ListenerCounterDecrement();
                LogHelper.LogMessage(string.Format("Listener with port {0} has terminated.", PublicPortRequested), Issue.IssueLevel.Information);
            }
        }
Example #4
0
 public TcpActorStoppedEventArgs(TcpActor tcpActor)
 {
     TcpActor = tcpActor;
 }
Example #5
0
 public TcpActorStoppedEventArgs(TcpActor tcpActor)
 {
     TcpActor = tcpActor;
 }