读超时时间设置为30s

This commit is contained in:
Guoqs
2024-11-28 09:28:51 +08:00
parent f89c0dc130
commit 91a2f482a0

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());
//读超时时间设置为15s0表示不监控
pipeline.addLast(new IdleStateHandler(15, 0, 0, TimeUnit.SECONDS));
// 读超时时间设置为30s0表示不监控
pipeline.addLast(new IdleStateHandler(30, 0, 0, TimeUnit.SECONDS));
pipeline.addLast("handler", nettyServerHandler);
}