From 03d28117cc2c713b668d231013e33f597d6e4e2e Mon Sep 17 00:00:00 2001 From: lv <1344032923@qq.com> Date: Mon, 28 Apr 2025 17:06:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E8=BF=9E=E6=97=A5=E5=BF=97=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/common/utils/GlobalTcp.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/entry/src/main/ets/common/utils/GlobalTcp.ts b/entry/src/main/ets/common/utils/GlobalTcp.ts index ea765d24..039c7d06 100644 --- a/entry/src/main/ets/common/utils/GlobalTcp.ts +++ b/entry/src/main/ets/common/utils/GlobalTcp.ts @@ -3,6 +3,8 @@ import { getSyncData } from '../service/initable'; import hilog from '@ohos.hilog'; import FileUtil from '../../common/utils/File' import { GlobalConfig } from '../../config/index' +const TAG = 'socketTag[TcpDemo.TcpClient]' + export async function getTCP(flag=false) { globalThis.getCloseTcp=true const fileUtil = new FileUtil(globalThis.context) @@ -34,6 +36,8 @@ export async function getTCP(flag=false) { await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 globalThis.tcpStep+=1 if(globalThis.tcpStep>30){ + console.log(TAG,'tcp重连开始') + globalThis.tcpStep=0 getTCP() } } @@ -73,7 +77,9 @@ export async function getTCP(flag=false) { await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 globalThis.tcpStep+=1 if(globalThis.tcpStep>30){ + globalThis.tcpStep=0 getTCP() + console.log(TAG,'tcp重连开始') } } },1000/3)