I have simple servlet on JBoss 5.1. When writing response a have no exception if connection closed. Connection closed by read timeout, from outside.
JBoss receives FIN, ACK, answers with ACK and after several seconds sends my response (PSH,ACK) and receives RST.
How to determine in servlet, that connection is closed and/or response is not writtеn successfully?
If you write enough data so that you are still writing after the RST arrives you will get an IOException: 'connection reset by peer'. TCP buffering and asynchronous writing means that this may not happen for a small write.