From 05e5da7edd1368a2e8f216b3efc6e87eb8d375a2 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期一, 26 六月 2023 17:24:58 +0800
Subject: [PATCH] 解析雷达报警报文
---
src/main/java/com/ard/utils/tcp/NettyTcpClient.java | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/ard/utils/tcp/NettyTcpClient.java b/src/main/java/com/ard/utils/tcp/NettyTcpClient.java
index 2d01793..2d6c324 100644
--- a/src/main/java/com/ard/utils/tcp/NettyTcpClient.java
+++ b/src/main/java/com/ard/utils/tcp/NettyTcpClient.java
@@ -2,6 +2,7 @@
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
@@ -36,6 +37,14 @@
}
});
ChannelFuture future = bootstrap.connect(host, port).sync();
+ // 娣诲姞杩炴帴鎴愬姛鐨勭洃鍚櫒
+ future.addListener((ChannelFutureListener) future1 -> {
+ if (future1.isSuccess()) {
+ log.info("tcp杩炴帴鎴愬姛"+host+":"+port);
+ } else {
+ log.info("tcp杩炴帴澶辫触"+host+":"+port);
+ }
+ });
future.channel().closeFuture().sync();
} catch (Exception ex) {
--
Gitblit v1.9.3