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