specifically i am interested in the case where the other end of the channel dies unexpectedly (eg the process gets killed). it seems that netty does not reliably fire a channel closed/disconnect event, sometimes it does and sometimes it does not. it also does not necessarily throw a SocketException for connection reset.
for what it's worth, i have also tried writing to the channel but this also continues to work without throwing exceptions or firing any other events.
i am testing this on windows, with netty 3.3.0.Final, if that makes any difference.
If a channel disconnects without sending close there is no way to detect it. Usually the best way to detect a disconnect if needed is to periodically send heartbeat events over the channel ever x seconds. Using IdleStateHandler, if you don't receive the heartbeat after the heartbeat + a delta you force disconnect the channel.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With