public class NioQuickClient extends Object implements Closeable
| Constructor and Description |
|---|
NioQuickClient(InetSocketAddress address)
构造
|
NioQuickClient(String host,
int port)
构造
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
SocketChannel |
getChannel()
获取SocketChannel
|
NioQuickClient |
init(InetSocketAddress address)
初始化
|
void |
listen()
开始监听
|
NioQuickClient |
setChannelHandler(ChannelSocketHandler handler)
设置NIO数据处理器
|
NioQuickClient |
write(ByteBuffer... datas)
实现写逻辑
当收到写出准备就绪的信号后,回调此方法,用户可向客户端发送消息 |
public NioQuickClient(String host, int port)
host - 服务器地址port - 端口public NioQuickClient(InetSocketAddress address)
address - 服务器地址public NioQuickClient init(InetSocketAddress address)
address - 地址和端口public NioQuickClient setChannelHandler(ChannelSocketHandler handler)
handler - ChannelSocketHandlerpublic void listen()
public NioQuickClient write(ByteBuffer... datas)
datas - 发送的数据public SocketChannel getChannel()
public void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2021. All rights reserved.