No exception when writing response to closed conne

2019-08-31 07:49发布

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?

1条回答
Bombasti
2楼-- · 2019-08-31 08:12

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.

查看更多
登录 后发表回答