Commit 085c6e059f70be1bc997f8e41e16686b54c282a9

Authored by 芯火源
1 parent e73eb81b

fix: 解决TCP乱码问题

TCP收到的数据都是16进制内容。
... ... @@ -156,7 +156,7 @@ public class TcpTransportHandler extends ChannelInboundHandlerAdapter implements
156 156 if (msg instanceof ByteBuf) {
157 157 ByteBuf message = (ByteBuf) msg;
158 158 byte[] byteMsg = ByteUtils.buf2Bytes(message);
159   - String msgStr = ByteUtils.getString(byteMsg, ByteUtils.UTF_8);
  159 + String msgStr = ByteUtils.bytesToHex(byteMsg);
160 160 log.error("会话【{}】收到设备【{}】来自【{}】数据【{}】", sessionId, deviceSessionCtx.getDeviceId(), address, msgStr);
161 161 deviceSessionCtx.setChannel(ctx);
162 162 if (deviceSessionCtx.getDeviceInfo() == null || deviceSessionCtx.getDeviceProfile() == null) {
... ...