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)