Example #1
0
        private void HandleDatagramReceived(object sender, DataGramReceivedArgs args)
        {
            var messageHeader = new MessageHeader();

            using (var reader = new BinaryReader(new MemoryStream(args.Data)))
            {
                if (messageHeader.ReadFromStream(reader))
                {
                    _logger.LogDebug("Recieved {PACKET} from {SENDER}", messageHeader.Type.ToString(), args.Sender.Address.ToString());
                    _messageDispatcher.DispatchDatagramMessage(messageHeader, reader, args.Sender);
                }
            }
        }