public class NioServer extends Object implements Closeable
| Constructor and Description | 
|---|
| NioServer(int port)构造 | 
| Modifier and Type | Method and Description | 
|---|---|
| void | close() | 
| Selector | getSelector()获取 Selector | 
| NioServer | init(InetSocketAddress address)初始化 | 
| void | listen()开始监听 | 
| NioServer | setChannelHandler(ChannelHandler handler)设置NIO数据处理器 | 
| void | start()启动NIO服务端,即开始监听 | 
public NioServer init(InetSocketAddress address)
address - 地址和端口public NioServer setChannelHandler(ChannelHandler handler)
handler - ChannelHandlerpublic void start()
listen()public void listen()
public void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2025. All rights reserved.