Esempio n. 1
0
        private void HandleMessage(byte[] buffer, int count, IPEndPoint remote)
        {
            IList <ISnmpMessage> messages = null;

            try
            {
                messages = MessageFactory.ParseMessages(buffer, 0, count, _users);
            }
            catch (Exception ex)
            {
                var exception = new MessageFactoryException("Invalid message bytes found. Use tracing to analyze the bytes.", ex);
                exception.SetBytes(buffer);
                HandleException(exception);
            }

            if (messages == null)
            {
                return;
            }

            foreach (var message in messages)
            {
                var handler = MessageReceived;
                handler?.Invoke(this, new MessageReceivedEventArgs(remote, message, this));
            }
        }
Esempio n. 2
0
        private void HandleMessage(MessageParams param)
        {
            IList <ISnmpMessage> messages = null;

            try
            {
                messages = MessageFactory.ParseMessages(param.GetBytes(), 0, param.Number, _users);
            }
            catch (Exception ex)
            {
                var exception = new MessageFactoryException("Invalid message bytes found. Use tracing to analyze the bytes.", ex);
                exception.SetBytes(param.GetBytes());
                HandleException(exception);
            }

            if (messages == null)
            {
                return;
            }

            foreach (var message in messages)
            {
                var handler = MessageReceived;
                if (handler != null)
                {
                    handler(this, new MessageReceivedEventArgs(param.Sender, message, this));
                }
            }
        }
        private void HandleMessage(MessageParams param)
        {
            IList<ISnmpMessage> messages = null;
            try
            {
                messages = MessageFactory.ParseMessages(param.GetBytes(), 0, param.Number, _users);
            }
            catch (Exception ex)
            {
                var exception = new MessageFactoryException("Invalid message bytes found. Use tracing to analyze the bytes.", ex);
                exception.SetBytes(param.GetBytes());
                HandleException(exception);
            }

            if (messages == null)
            {
                return;
            }

            foreach (var message in messages)
            {
                var handler = MessageReceived;
                if (handler != null)
                {
                    handler(this, new MessageReceivedEventArgs(param.Sender, message, this));
                }
            }
        }
Esempio n. 4
0
        private void HandleMessage(byte[] buffer, int count, IPEndPoint remote)
        {
            IList<ISnmpMessage> messages = null;
            try
            {
                messages = MessageFactory.ParseMessages(buffer, 0, count, _users);
            }
            catch (Exception ex)
            {
                var exception = new MessageFactoryException("Invalid message bytes found. Use tracing to analyze the bytes.", ex);
                exception.SetBytes(buffer);
                HandleException(exception);
            }

            if (messages == null)
            {
                return;
            }

            foreach (var message in messages)
            {
                var handler = MessageReceived;
                if (handler != null)
                {
                    handler(this, new MessageReceivedEventArgs(remote, message, this));
                }
            }
        }