You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
586 B
18 lines
586 B
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 }));
|
|
}
|
|
} |