first commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using DotNetty.Buffers;
|
||||
using DotNetty.Codecs;
|
||||
using DotNetty.Transport.Channels;
|
||||
using JSMachine.WMS.Infrastructure.Helper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JSMachine.WMS.Netty.NettyAsClient.Codec
|
||||
{
|
||||
public class EnCoderPrint : MessageToByteEncoder<byte[]>
|
||||
{
|
||||
private string _encoderWord;
|
||||
|
||||
public EnCoderPrint() : base() { }
|
||||
|
||||
public EnCoderPrint(string encoderWord)
|
||||
{
|
||||
_encoderWord = encoderWord;
|
||||
}
|
||||
protected override void Encode(IChannelHandlerContext context, byte[] message, IByteBuffer output)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] body = message;
|
||||
//byte[] tail = Encoding.UTF8.GetBytes(_encoderWord);
|
||||
|
||||
output.WriteBytes(body);
|
||||
//output.WriteBytes(tail);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"TCP编码异常,异常信息 {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user