简体   繁体   中英

Netty disconnects channel after roughly 10 minutes

I've setup my netty server and everything is fine and dandy, however it disconnects channels after around 10 minutes of them being connected. I've tried adding these keys to the server bootstrap:

bootstrap.setOption("reuseAddress", true);
bootstrap.setOption("child.tcpNoDelay", true);
bootstrap.setOption("child.TcpAckFrequency", true);
bootstrap.setOption("child.keepAlive", true);
bootstrap.setOption("keepAlive", true);

However, I didn't set these options to the client bootstrap. I'm not sure if that's a problem or not, would like some help with this.

Okay I've made a feature that sends a packet to the client every minute, and so far, so good. I think it's because I would leave the client without sending or reading any packets for a good length of time, and I guess the server disconnected it because of that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM