From 8f0b923744d4d54ce962b63a6d675a483fb04c9a Mon Sep 17 00:00:00 2001 From: chendaofei <857448963@qq.com> Date: Fri, 20 Dec 2024 16:36:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../socket/service/NettyServerHandler.java | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/detection/src/main/java/com/njcn/gather/detection/util/socket/service/NettyServerHandler.java b/detection/src/main/java/com/njcn/gather/detection/util/socket/service/NettyServerHandler.java index dd143b70..a8eea77c 100644 --- a/detection/src/main/java/com/njcn/gather/detection/util/socket/service/NettyServerHandler.java +++ b/detection/src/main/java/com/njcn/gather/detection/util/socket/service/NettyServerHandler.java @@ -43,10 +43,27 @@ public class NettyServerHandler extends SimpleChannelInboundHandler { }else{ channel.writeAndFlush("socket指令结果:成功指令"); }*/ - JSONObject jsonObject = new JSONObject(); - jsonObject.put("requestId","yjc_ytxjy"); - jsonObject.put("code","10200"); - channel.writeAndFlush(jsonObject.toJSONString()+'\n'); + if(!msg.contains("HeartBeat")){ + JSONObject jsonObject1 = new JSONObject(); + jsonObject1.put("requestId","yjc_ytxjy"); + jsonObject1.put("operateCode","INIT_GATHER"); + jsonObject1.put("code","10201"); + channel.writeAndFlush(jsonObject1.toJSONString()+'\n'); + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("requestId","yjc_ytxjy"); + jsonObject.put("operateCode","INIT_GATHER"); + jsonObject.put("code","10200"); + channel.writeAndFlush(jsonObject.toJSONString()+'\n'); + } + + } @Override