Hi
I made a client-server system using Netty. The server is running in DMZ and the client in SZ, so only the client can establish the connection. The client establishes the connection and a few messages is exchanged. After than silence, except when the server needs to send something to the client, but it can be hours or days in between. It is working fine, except that the connection is broken, when the server wants to send something to the client, if "enough" time has passed since the last message exchange. It seems to be 2 hours that is the limit. The symptoms are that the server tries to send the message, but it cannot do it, it gets "Connection reset by peer". The server cannot reestablish the connection. It is the responsibility of the client to make sure that the connection is up, and it does so by reestablishing in case it notices it is down. The problem (using Netty 4.1.16.Final) is that the client is never notified (via channelInactive) that the connection is down, so it will not reestablish. Net-result is that the server cannot send the message to the client. I have upgraded to 4.1.21.Final, and now it seems (havnt tested thoroughly yet) that the client is actually notified, and it can reestablish. But I would rather that the connections are not being shut down automatically behind the scenes. I have added SO_KEEPALIVE all kinds of places, but it does not seem to change the behavior. Any idea why the inactive connections are automatically shut down? And how to avoid it? I have several connections, and for most of them it is fine that they are shut down if there is no activity, put for a particular connection it would be nice if it is not. So being able to avoiding the automatic shutdown on a per-connection-basis would be optimal.
Regards, Per Steffensen