using DotNetty.Buffers; using DotNetty.Transport.Channels; using HybirdFrameworkCore.Autofac.Attribute; using log4net; namespace HybirdFrameworkServices.Netty; [Scope("InstancePerDependency")] public class MsgHandler : ChannelHandlerAdapter { private readonly ILog Log = LogManager.GetLogger(typeof(MsgHandler)); public override void ChannelRead(IChannelHandlerContext ctx, object msg) { Log.Info($"{this.GetHashCode()} read from {ctx.Channel.RemoteAddress}"); ctx.WriteAndFlushAsync(Unpooled.WrappedBuffer(new byte[] { 1, 2, 3, 4, 5, 6, 7 })); } }