浏览代码

修复一个回包问题

luoguangyi 3 年之前
父节点
当前提交
772b90d7d5

+ 1 - 1
src/main/java/com/persagy/iottransfer/communication/mina/tcp/client/TCPClientManager.java

@@ -366,7 +366,7 @@ public class TCPClientManager implements IClientManager {
                         this.connector = connectorInner;
                     } else {
                         connectorInner.dispose();
-                        throw new Exception();
+                        throw new Exception("连接服务端"+this.ip+":"+this.port+"失败");
                     }
                 } else {
                     connectorInner.dispose();

+ 2 - 2
src/main/java/com/persagy/iottransfer/server/IotServerReceiveMessageThread.java

@@ -33,7 +33,7 @@ public class IotServerReceiveMessageThread implements Runnable {
             while (true) {
                 try {
                     tcpControl = IotServer.tcpControlServerManager.takeRece();
-                    if (tcpControl != null && tcpControl.address == null) {
+                    if (tcpControl != null && tcpControl.address != null) {
                         addProject(tcpControl, "tcpControl");
                         log.info("收到iot-project 控制消息:{}", tcpControl);
                         kafkaProducer.sendFromedge2control(tcpControl);
@@ -47,7 +47,7 @@ public class IotServerReceiveMessageThread implements Runnable {
             while (true) {
                 try {
                     tcpCollect = IotServer.tcpCollectServerManager.takeRece();
-                    if (tcpCollect != null && tcpCollect.address == null) {
+                    if (tcpCollect != null && tcpCollect.address != null) {
                         addProject(tcpCollect, "tcpCollect");
                         log.info("收到iot-project 采集消息:{}", tcpCollect);
                         kafkaProducer.sendFromedge2collect(tcpCollect);

+ 7 - 7
src/main/resources/application-zs.yml

@@ -9,11 +9,11 @@ spring:
       key-password: cmsk-ioc-1234
       key-store-type: JKS
       #ssl配置绝对路径
-      key-store-location: file:/usr/persagy/iot-transfer/config/client.keystore.jks  #windows参考 file://D:\temp\ioc-ssl\client.keystore.jks
+      key-store-location: file:D:\temp\ioc-ssl\client.keystore.jks #file:/usr/persagy/iot-transfer/config/client.keystore.jks  #windows参考 file://D:\temp\ioc-ssl\client.keystore.jks
       key-store-password: cmsk-ioc-1234
       trust-store-type: JKS
       #ssl配置绝对路径
-      trust-store-location: file:/usr/persagy/iot-transfer/config/client.truststore.jks #windows参考  file://D:\temp\ioc-ssl\client.truststore.jks
+      trust-store-location: file:D:\temp\ioc-ssl\client.truststore.jks #file:/usr/persagy/iot-transfer/config/client.truststore.jks #windows参考  file://D:\temp\ioc-ssl\client.truststore.jks
       trust-store-password: cmsk-ioc-1234
     producer:
       # 发生错误后,消息重发的次数。
@@ -68,19 +68,19 @@ iot:
   # 程序一式两份,一份部署在云端,一份部署在边缘端,一式两份之间通过kafka通讯,实现内外网之间的iot数据通讯
   type:
     # 程序部署位置类型,部署在云端一侧的,需要设置cloud为true,edge为false,需要更改
-    cloud: false
+    cloud: true
     # 程序部署位置类型,部署在边缘端一侧的,需要设置cloud为false,edge为true,需要更改
-    edge: false
+    edge: true
   server:
     #同原来iot-collect中的util.xml配置,用于部署在需要更改edge边缘端给iot-project通讯使用,需要更改
     collect:
       tcp_enable: true
       tcp_bind_ip: 0.0.0.0
       #需要更改
-      tcp_bind_port: 8861
+      tcp_bind_port: 8851
       udp_enable: false
       udp_bind_ip: 0.0.0.0
-      udp_bind_port: 8851
+      udp_bind_port: 8861
       max_size: 1000
       sleepcount: 1000
       separate_begin: (
@@ -105,7 +105,7 @@ iot:
       #iot-collect IP,需要更改
       target_ip: 127.0.0.1
       #iot-collect port,需要更改
-      target_port: 8855
+      target_port: 8861
       max_size: 1000
       sleepcount: 1000
       separate_begin: (

+ 1 - 1
src/main/resources/application.yml

@@ -6,4 +6,4 @@ spring:
   application:
     name: iot-transfer
   profiles:
-    active: zs
+    active: ZS