first commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user