读超时时间设置为15s

This commit is contained in:
Guoqs
2024-11-28 09:27:46 +08:00
parent eca0a75eb9
commit f89c0dc130

View File

@@ -24,8 +24,8 @@ public class NettyServerChannelInitializer extends ChannelInitializer<SocketChan
// pipeline.addLast("frameDecoder", new YkcProtocolDecoder());
pipeline.addLast("decoder", new ByteArrayDecoder());
pipeline.addLast("encoder", new ByteArrayDecoder());
//读超时时间设置为10s0表示不监控
pipeline.addLast(new IdleStateHandler(60, 0, 0, TimeUnit.SECONDS));
//读超时时间设置为15s0表示不监控
pipeline.addLast(new IdleStateHandler(15, 0, 0, TimeUnit.SECONDS));
pipeline.addLast("handler", nettyServerHandler);
}