예제 #1
0
        protected override void ChannelRead0(IChannelHandlerContext ctx, DatagramPacket packet)
        {
            SelfLog.WriteLine($"Server Received => {packet}");

            if (!packet.Content.IsReadable() || !packet.Content.HasArray)
            {
                SelfLog.WriteLine("Content of UDP packet is null");
                return;
            }

            try
            {
                var buffer = new byte[packet.Content.ReadableBytes];
                packet.Content.ReadBytes(buffer);
                _loggingManager.Post(buffer);
            }
            catch (Exception ex)
            {
                Console.WriteLine("ChannelRead0 Error:" + ex);
            }
        }