34 lines
1.0 KiB
C#
34 lines
1.0 KiB
C#
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();
|
|
}
|
|
}
|
|
}
|
|
}
|