netty中非阻塞通道中的SO_TIMEOUT

use*_*845 6 netty

如果通道在超时毫秒内没有收到读/响应,SO_TIMEOUT是否会使非阻塞通道失效?

bootstrap.group(workerGroup).channel(NioSocketChannel.class).
.handler(channelInitializer).option(ChannelOption.SO_TIMEOUT, 100);
Run Code Online (Sandbox Code Playgroud)

此外,该选项是否也适用于服务器频道?喜欢:

serverBootstrap.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).
localAddress(new InetSocketAddress(8800)).childHandler(serverChannelInitializer).
option(ChannelOption.SO_TIMEOUT, 100).bind().sync();
Run Code Online (Sandbox Code Playgroud)

Nor*_*rer 8

号码SO_TIMEOUT仅对OIO插座传输有效.您应该在实现中使用IdleStateHandler和处理.IdleStateEventuserEventTriggered()