Пример #1
0
        public void Initialize()
        {
            Task.Factory.StartNew(() =>
            {
                lock (_snifferLock)
                {
                    if (_teraSniffer != null)
                    {   //dereference the existing sniffer if it exists
                        var sniffer              = _teraSniffer;
                        _teraSniffer             = null;
                        sniffer.Enabled          = false;
                        sniffer.MessageReceived -= HandleMessageReceived;
                        sniffer.NewConnection   -= HandleNewConnection;
                        Logger.Info("Sniffer has been disabled.");
                    }

                    IpSniffer ipSniffer = null;
                    if (UseRawSockets)
                    {
                        ipSniffer = new IpSnifferRawSocketMultipleInterfaces();
                    }

                    _teraSniffer = new TeraSniffer(ipSniffer, BasicTeraData.Servers);
                    _teraSniffer.MessageReceived += HandleMessageReceived;
                    _teraSniffer.NewConnection   += HandleNewConnection;
                    _teraSniffer.Enabled          = true;

                    Logger.Info("Sniffer has been enabled.");
                }
            }, TaskCreationOptions.LongRunning);//provide hint to start on new thread
        }
Пример #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            _teraSniffer = new TeraSniffer(_basicTeraData.Servers);
            _teraSniffer.MessageReceived += teraSniffer_MessageReceived;
            _teraSniffer.NewConnection += _teraSniffer_NewConnection;

            _teraSniffer.Enabled = true;
        }
Пример #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            _teraSniffer = new TeraSniffer(_basicTeraData.Servers);
            _teraSniffer.MessageReceived += teraSniffer_MessageReceived;
            _teraSniffer.NewConnection   += _teraSniffer_NewConnection;

            _teraSniffer.Enabled = true;
        }
Пример #4
0
        public void Initialize()
        {
            if (_teraSniffer != null)
            {   //dereference the existing sniffer if it exists
                var sniffer = _teraSniffer;
                _teraSniffer = null;
                sniffer.Enabled = false;
                sniffer.MessageReceived -= HandleMessageReceived;
                sniffer.NewConnection -= HandleNewConnection;
                Logger.Info("Sniffer has been disabled.");
            }

            _teraSniffer = new TeraSniffer(BasicTeraData.Servers);
            _teraSniffer.MessageReceived += HandleMessageReceived;
            _teraSniffer.NewConnection += HandleNewConnection;
            _teraSniffer.Enabled = true;

            Logger.Info("Sniffer has been enabled.");
        }
Пример #5
0
        public void Initialize()
        {
            Task.Factory.StartNew(() =>
            {
                lock (_snifferLock)
                {
                    if (_teraSniffer != null)
                    {   //dereference the existing sniffer if it exists
                        var sniffer = _teraSniffer;
                        _teraSniffer = null;
                        sniffer.Enabled = false;
                        sniffer.MessageReceived -= HandleMessageReceived;
                        sniffer.NewConnection -= HandleNewConnection;
                        Logger.Info("Sniffer has been disabled.");
                    }

                    IpSniffer ipSniffer = null;
                    if (UseRawSockets)
                    {
                        ipSniffer = new IpSnifferRawSocketMultipleInterfaces();
                    }

                    _teraSniffer = new TeraSniffer(ipSniffer, BasicTeraData.Servers);
                    _teraSniffer.MessageReceived += HandleMessageReceived;
                    _teraSniffer.NewConnection += HandleNewConnection;
                    _teraSniffer.Enabled = true;

                    Logger.Info("Sniffer has been enabled.");
                }
            }, TaskCreationOptions.LongRunning);//provide hint to start on new thread
        }