Looly 5 年 前
コミット
dd0dd65faf

+ 13 - 3
hutool-socket/src/main/java/cn/hutool/socket/nio/NioClient.java

@@ -1,14 +1,14 @@
 package cn.hutool.socket.nio;
 
+import cn.hutool.core.io.IORuntimeException;
+import cn.hutool.core.io.IoUtil;
+
 import java.io.Closeable;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.nio.ByteBuffer;
 import java.nio.channels.SocketChannel;
 
-import cn.hutool.core.io.IORuntimeException;
-import cn.hutool.core.io.IoUtil;
-
 /**
  * NIO客户端
  *
@@ -85,6 +85,16 @@ public class NioClient implements Closeable {
 		return this;
 	}
 
+	/**
+	 * 获取SocketChannel
+	 *
+	 * @return SocketChannel
+	 * @since 5.3.10
+	 */
+	public SocketChannel getChannel() {
+		return this.channel;
+	}
+
 	@Override
 	public void close() {
 		IoUtil.close(this.channel);