netty中非阻塞通道中的SO_超时
如果通道在超时毫秒内未收到读取/响应,SO_超时是否会使非阻塞通道过期netty中非阻塞通道中的SO_超时,netty,Netty,如果通道在超时毫秒内未收到读取/响应,SO_超时是否会使非阻塞通道过期 bootstrap.group(workerGroup).channel(NioSocketChannel.class). .handler(channelInitializer).option(ChannelOption.SO_TIMEOUT, 100); 此外,该选项是否也适用于服务器通道?比如: serverBootstrap.group(bossGroup, workerGroup).channel(NioServ
bootstrap.group(workerGroup).channel(NioSocketChannel.class).
.handler(channelInitializer).option(ChannelOption.SO_TIMEOUT, 100);
此外,该选项是否也适用于服务器通道?比如:
serverBootstrap.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).
localAddress(new InetSocketAddress(8800)).childHandler(serverChannelInitializer).
option(ChannelOption.SO_TIMEOUT, 100).bind().sync();
否。
SO\u TIMEOUT
仅对OIO套接字传输有效。您应该使用IdleStateHandler
并在userEventTriggered()
实现中处理IdleStateEvent
。它仅在阻塞模式下有效。非阻塞模式下的超时在术语上是矛盾的。