public class SocketUtil extends Object
Constructor and Description |
---|
SocketUtil() |
Modifier and Type | Method and Description |
---|---|
static SocketAddress |
getRemoteAddress(AsynchronousSocketChannel channel)
获取远程端的地址信息,包括host和端口
null表示channel为null或者远程主机未连接 |
static boolean |
isConnected(AsynchronousSocketChannel channel)
远程主机是否处于连接状态
通过判断远程地址获取成功与否判断 |
public static SocketAddress getRemoteAddress(AsynchronousSocketChannel channel)
channel
- AsynchronousSocketChannel
public static boolean isConnected(AsynchronousSocketChannel channel)
channel
- AsynchronousSocketChannel
Copyright © 2021. All rights reserved.