Files
ww-jst/wmsjst/JSMachine.WMS.Netty/NettyAsServer/Codec/Decoder.cs
T

34 lines
1.0 KiB
C#
Raw Normal View History

2026-09-02 16:31:50 +08:00
using DotNetty.Buffers;
using DotNetty.Codecs;
using DotNetty.Transport.Channels;
using JSMachine.WMS.Infrastructure.Helper;
using System;
using System.Collections.Generic;
namespace JSMachine.WMS.Netty.NettyAsServer.Codec
{
public class Decoder : ByteToMessageDecoder
{
protected override void Decode(IChannelHandlerContext context, IByteBuffer input, List<object> output)
{
if (input != null)
{
int length = input.ReadableBytes;
byte[] bytes = new byte[length];
input.ReadBytes(bytes);
try
{
//IMessagePackage message = MessagePackageMange.Instance.BinaryDeserializeToObject(bytes);
output.Add(null);
}
catch (Exception ex)
{
LogHelper.Error($"解码远程地址:{context.Channel.RemoteAddress}----发送的数据异常");
}
input.Clear();
}
}
}
}