重连
This commit is contained in:
		
							parent
							
								
									776843b9df
								
							
						
					
					
						commit
						6b6a2ba669
					
				| @ -28,10 +28,14 @@ export async function getTCP(flag=false) { | |||||||
|           console.log('ttttttt00') |           console.log('ttttttt00') | ||||||
| 
 | 
 | ||||||
|           clearInterval(globalThis.intervalSendmsg) |           clearInterval(globalThis.intervalSendmsg) | ||||||
|           globalThis.intervalSendmsg=setInterval(()=>{ |           globalThis.intervalSendmsg=setInterval(async ()=>{ | ||||||
|             console.log('getCloseTcp',globalThis.carInfo.carNo) |             console.log('getCloseTcp',globalThis.carInfo.carNo) | ||||||
|             if(!globalThis.getCloseTcp){ |             if(!globalThis.getCloseTcp){ | ||||||
|               globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
 |               await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
 | ||||||
|  |               globalThis.tcpStep+=1 | ||||||
|  |               if(globalThis.tcpStep>10){ | ||||||
|  |                 getTCP() | ||||||
|  |               } | ||||||
|             } |             } | ||||||
|           },1000/3) |           },1000/3) | ||||||
|           globalThis.TcpClient.onError((val) => { |           globalThis.TcpClient.onError((val) => { | ||||||
| @ -63,10 +67,14 @@ export async function getTCP(flag=false) { | |||||||
|       console.log('ttttttt12') |       console.log('ttttttt12') | ||||||
| 
 | 
 | ||||||
|       clearInterval(globalThis.intervalSendmsg) |       clearInterval(globalThis.intervalSendmsg) | ||||||
|       globalThis.intervalSendmsg=setInterval(()=>{ |       globalThis.intervalSendmsg=setInterval(async ()=>{ | ||||||
|         // console.log('getCloseTcp',globalThis.getCloseTcp)
 |         // console.log('getCloseTcp',globalThis.getCloseTcp)
 | ||||||
|         if(!globalThis.getCloseTcp){ |         if(!globalThis.getCloseTcp){ | ||||||
|           globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
 |           await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
 | ||||||
|  |           globalThis.tcpStep+=1 | ||||||
|  |           if(globalThis.tcpStep>10){ | ||||||
|  |             getTCP() | ||||||
|  |           } | ||||||
|         } |         } | ||||||
|       },1000/3) |       },1000/3) | ||||||
|       globalThis.TcpClient.onError((val) => { |       globalThis.TcpClient.onError((val) => { | ||||||
|  | |||||||
| @ -156,7 +156,7 @@ export default class TcpClient { | |||||||
|         //   time:dateFormat(new Date()),
 |         //   time:dateFormat(new Date()),
 | ||||||
|         //   message: `${TAG} TCPsend error ${JSON.stringify(err)}`,
 |         //   message: `${TAG} TCPsend error ${JSON.stringify(err)}`,
 | ||||||
|         // })
 |         // })
 | ||||||
|         reslove(false) |         reject(false) | ||||||
|       }); |       }); | ||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
| @ -167,6 +167,7 @@ export default class TcpClient { | |||||||
|       //   time:dateFormat(new Date()),
 |       //   time:dateFormat(new Date()),
 | ||||||
|       //   PLC:`${TAG} Tcponmessage`,
 |       //   PLC:`${TAG} Tcponmessage`,
 | ||||||
|       // })
 |       // })
 | ||||||
|  |       globalThis.tcpStep=0 | ||||||
|       globalThis.tcpUdpError = false |       globalThis.tcpUdpError = false | ||||||
| 
 | 
 | ||||||
|       // console.log('messageLengt',,value.message.length))
 |       // console.log('messageLengt',,value.message.length))
 | ||||||
|  | |||||||
| @ -56,7 +56,7 @@ export default class EntryAbility extends UIAbility { | |||||||
|     globalThis.judgeVersion = GlobalConfig.version.jn.km3[1]; |     globalThis.judgeVersion = GlobalConfig.version.jn.km3[1]; | ||||||
|     globalThis.tcpSendNum = 0 |     globalThis.tcpSendNum = 0 | ||||||
|     globalThis.videoVersion = '1.0' |     globalThis.videoVersion = '1.0' | ||||||
| 
 |     globalThis.tcpStep=0 | ||||||
|     //视频遮挡 |     //视频遮挡 | ||||||
|     globalThis.spzd = { |     globalThis.spzd = { | ||||||
|       spzd1: false, |       spzd1: false, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user