public class AioServerSocket extends SocketContext
ASYNCHRONOUS_CHANNEL_GROUP, connectModel, filterChain, handler, host, idleInterval, messageSplitter, port, readBufferSize, readRecursionDepth, readTimeout, sendBufferSize, sendTimeout, sslManager| Constructor and Description |
|---|
AioServerSocket(String host,
int port,
int readTimeout)
构造函数
默认不会出发空闲事件, 默认发超时时间: 1s
|
AioServerSocket(String host,
int port,
int readTimeout,
int idleInterval)
构造函数
默认发超时时间: 1s
|
AioServerSocket(String host,
int port,
int readTimeout,
int sendTimeout,
int idleInterval)
构造函数
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
acceptStart()
用于针对 Accept 进来的 Socket 连接的启动
|
protected void |
catchAccept()
捕获 Aio Accept 事件
|
boolean |
close()
关闭连接
|
boolean |
isConnected()
上下文连接是否连接
|
boolean |
isOpen()
上下文连接是否打开
|
void |
setIdleInterval(int idleInterval)
设置空闲事件时间
|
<T> void |
setOption(SocketOption<T> name,
T value)
设置 Socket 的 Option 选项
|
AsynchronousServerSocketChannel |
socketChannel()
获取 SocketChannel 对象
|
void |
start()
启动监听
阻塞方法
|
void |
syncStart()
启动同步监听
非阻塞方法
|
buildAsynchronousChannelGroup, copyFrom, filterChain, getConnectModel, getHost, getIdleInterval, getPort, getReadBufferSize, getReadRecursionDepth, getReadTimeout, getSendBufferSize, getSendTimeout, getSSLManager, handler, handler, initSSL, messageSplitter, messageSplitter, setReadBufferSize, setReadRecursionDepth, setSendBufferSize, setSSLManager, waitConnectedpublic AioServerSocket(String host, int port, int readTimeout) throws IOException
host - 主机地址port - 主机端口readTimeout - 超时时间, 单位:毫秒IOException - IO 异常public AioServerSocket(String host, int port, int readTimeout, int idleInterval) throws IOException
host - 主机地址port - 主机端口idleInterval - 空闲事件触发时间, 单位: 秒readTimeout - 超时时间, 单位:毫秒IOException - IO 异常public AioServerSocket(String host, int port, int readTimeout, int sendTimeout, int idleInterval) throws IOException
host - 主机地址port - 主机端口idleInterval - 空闲事件触发时间, 单位: 秒readTimeout - 超时时间, 单位:毫秒sendTimeout - 发超时时间, 单位: 毫秒IOException - IO 异常public void setIdleInterval(int idleInterval)
SocketContextsetIdleInterval in class SocketContextidleInterval - 空闲事件时间, 单位:秒public <T> void setOption(SocketOption<T> name, T value) throws IOException
setOption in class SocketContextT - 范型name - SocketOption类型的枚举, 参照:AsynchronousServerSocketChannel.setOption的说明value - SocketOption参数IOException - IO异常public AsynchronousServerSocketChannel socketChannel()
protected void catchAccept()
public void start()
throws IOException
start in class SocketContextIOException - IO 异常public void syncStart()
throws IOException
syncStart in class SocketContextIOException - IO异常protected void acceptStart()
throws IOException
SocketContextacceptStart in class SocketContextIOException - IO异常public boolean isOpen()
SocketContextisOpen in class SocketContextpublic boolean isConnected()
SocketContextisConnected in class SocketContextpublic boolean close()
SocketContextclose in class SocketContextCopyright © 2019 Voovan. All rights reserved.