Commit 06947ed3 authored by 耿迪迪's avatar 耿迪迪

设备上报 gengdidi

parent e66c5683
......@@ -75,14 +75,15 @@ public class ServerHandler extends ChannelInboundHandlerAdapter {
ByteBuf readMessage= (ByteBuf) msg;
String msgStr = readMessage.toString(CharsetUtil.UTF_8);
logger.info("receiveMsgstr======="+msgStr);
if(msgStr.length() != 124){
/*if(msgStr.length() != 124){
return;
}
}*/
byte[] bytes = HexUtils.hexToByteArray( msgStr.substring(0,msgStr.length()-4));
String checkVule = CrcUtil.getCrcToHex(bytes,true);
String checkCode = msgStr.substring(msgStr.length()-4,msgStr.length());
if(!checkVule.equals(checkCode)){
return;
logger.error("接收数据校验失败");
throw new Exception("接收数据校验失败");
}
SocketChannel channel=(SocketChannel)ctx.channel();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment