重连日志添加

This commit is contained in:
lv 2025-04-28 17:06:10 +08:00
parent 5d2e6cc6df
commit 03d28117cc

View File

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