Posts

Showing posts with the label netty

How to close connection forcedly in netty client side

How to close connection forcedly in netty client side Here's the story, I have a remote server and a client which behind a firewall. The client is implement by netty and it'll set up a keepalive connection to remote server. If there's no messages transfer in channel over 200 seconds, the firewall will reset the connection which is connect to remote server side, but the client side do not receive any tcp packets(such as RST package), so client consider that this connection is alive and the fact is not. So how to close the unusual connection forcedly before the firewall handle this keepalive connection incorrectly? BTW: I can't config the firewall 1 Answer 1 For tcp connections, you should send something to detect if it's active or broken. So I suggest you do something like these: Let the client send a heartbeat packet regularly to keep the connection alive. By doing these, t...