shjung před 3 roky
rodič
revize
52944d98f0

+ 1 - 2
src/main/java/com/its/api/xnetudp/codec/CenterCommServerDecoder.java

@@ -1,6 +1,5 @@
 package com.its.api.xnetudp.codec;
 
-import com.its.api.utils.SysUtils;
 import com.its.api.xnetudp.protocol.CENTER_COMM_MESSAGE;
 import io.netty.buffer.ByteBuf;
 import io.netty.channel.ChannelHandlerContext;
@@ -28,7 +27,7 @@ public class CenterCommServerDecoder extends MessageToMessageDecoder<DatagramPac
 
 		byte[] buffer = new byte[recvBytes];
 		buf.getBytes(buf.readerIndex(), buffer);
-		log.error("RECV UDP, DUMP: {}, {}", packet.sender().getAddress().getHostAddress(), SysUtils.byteArrayToHex(buffer));
+		//log.error("RECV UDP, DUMP: {}, {}", packet.sender().getAddress().getHostAddress(), SysUtils.byteArrayToHex(buffer));
 //01 00 01 01 00 01 00 00 00 00
 //27 07 01 01 00 FF 00 00 04 D1   0C 00 29 31 30 30
 //27 07 01 01 00 FF 00 00 00 10   0B 00 32 30 32 32 30 33 32 34 31 35 34 38 31 30

+ 12 - 4
src/main/java/com/its/api/xnetudp/protocol/CENTER_COMM_MESSAGE.java

@@ -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);

+ 4 - 4
src/main/java/com/its/api/xnetudp/thread/CenterCommServerReceiver.java

@@ -1,6 +1,5 @@
 package com.its.api.xnetudp.thread;
 
-import com.its.api.utils.SysUtils;
 import com.its.api.xnetudp.protocol.CENTER_COMM_DEFINE;
 import com.its.api.xnetudp.protocol.CENTER_COMM_MESSAGE;
 import lombok.extern.slf4j.Slf4j;
@@ -28,10 +27,11 @@ public class CenterCommServerReceiver {
             return;
         }
 
-        // VMS 통신 서버는 Sender, Receiver 위치가 바뀌었음.
-        if (CENTER_COMM_DEFINE.INT_ID_VMS_OPER == data.getSendId() && CENTER_COMM_DEFINE.INT_ID_VMS_SERVER == data.getRecvId()) {
+        // VMS 통신 서버는 Sender, Receiver 위치가 바뀌었음. ==> 서버 수정했음.
+        //if (CENTER_COMM_DEFINE.INT_ID_VMS_OPER == data.getSendId() && CENTER_COMM_DEFINE.INT_ID_VMS_SERVER == data.getRecvId()) {
+        if (CENTER_COMM_DEFINE.INT_ID_VMS_SERVER == data.getSendId()) {
             log.error("RECV VMS Server Message: {}, Length: {} Bytes.", data.getOpCode(), data.getLength());
-            log.error("VMS PACKET: {}", SysUtils.byteArrayToHex(data.getBody()));
+            //log.error("VMS PACKET: {}", SysUtils.byteArrayToHex(data.getBody()));
             if (data.getLength() > 0) {
                 ByteBuffer byteBuffer = ByteBuffer.wrap(data.getBody());
                 byteBuffer.order(ByteOrder.LITTLE_ENDIAN);