|
@@ -1,9 +1,12 @@
|
|
|
package com.its.api.xnetudp.protocol;
|
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+
|
|
|
import java.net.InetSocketAddress;
|
|
|
import java.nio.ByteBuffer;
|
|
|
import java.nio.ByteOrder;
|
|
|
|
|
|
+@Slf4j
|
|
|
public class CENTER_COMM_MESSAGE {
|
|
|
|
|
|
public static int CENTER_HEADER_SIZE = 8;
|
|
@@ -14,9 +17,9 @@ public class CENTER_COMM_MESSAGE {
|
|
|
private byte recvId;
|
|
|
private byte totalFrame;
|
|
|
private byte currentFrame;
|
|
|
- private byte msgSeq;
|
|
|
+ private byte msgSeq; // reserved
|
|
|
private byte opCode;
|
|
|
- private int length; // 2byte unsigned short
|
|
|
+ private int length; // 4byte unsigned short
|
|
|
|
|
|
private byte[] body;
|
|
|
|
|
@@ -37,7 +40,7 @@ public class CENTER_COMM_MESSAGE {
|
|
|
this.sender = inetSocketAddress;
|
|
|
|
|
|
ByteBuffer byteBuffer = ByteBuffer.wrap(buffer);
|
|
|
- byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
|
|
+ byteBuffer.order(ByteOrder.BIG_ENDIAN);
|
|
|
|
|
|
this.sendId = byteBuffer.get();
|
|
|
this.recvId = byteBuffer.get();
|
|
@@ -45,8 +48,13 @@ public class CENTER_COMM_MESSAGE {
|
|
|
this.currentFrame = byteBuffer.get();
|
|
|
this.msgSeq = byteBuffer.get();
|
|
|
this.opCode = byteBuffer.get();
|
|
|
- this.length = byteBuffer.getInt();
|
|
|
+ int length = byteBuffer.getInt();
|
|
|
this.length = byteBuffer.array().length - 10;
|
|
|
+ if (length != this.length) {
|
|
|
+ log.error("######################################################################Length Error: {}, {}", length, this.length);
|
|
|
+ log.error("######################################################################Length Error: {}, {}", length, this.length);
|
|
|
+ log.error("######################################################################Length Error: {}, {}", length, this.length);
|
|
|
+ }
|
|
|
if (this.length > 0) {
|
|
|
this.body = new byte[this.length];
|
|
|
byteBuffer.get(this.body);
|