Re: Detecting clsoed socket on OutputStream.Write
- From: EJP <esmond.not.pitt@xxxxxxxxxxxxxxx>
- Date: Fri, 30 Jun 2006 00:02:00 GMT
Knute Johnson wrote:
I don't know what causes the expected behavior to fail.
What causes this 'expected behaviour' to 'fail' is TCP asynchronous writing and buffering. If the write to the socket just goes into your local send buffer and the remote close hasn't already been detected, your write will succeed. It's only when you write *after* the remote close has been detected that you can get an IOException, and this in turn can only happen if there was data still pending to be written when the remote closure occurred.
In practice this means doing a number of writes to provoke the IOException: you can't rely on a single write doing it, i.e. you can't rely on the *next* write getting an IOException.
.
- Follow-Ups:
- Re: Detecting clsoed socket on OutputStream.Write
- From: Knute Johnson
- Re: Detecting clsoed socket on OutputStream.Write
- References:
- Detecting clsoed socket on OutputStream.Write
- From: david . topham
- Re: Detecting clsoed socket on OutputStream.Write
- From: Knute Johnson
- Detecting clsoed socket on OutputStream.Write
- Prev by Date: Re: 2 newbie questions
- Next by Date: Simple(?) synchronized() block question
- Previous by thread: Re: Detecting clsoed socket on OutputStream.Write
- Next by thread: Re: Detecting clsoed socket on OutputStream.Write
- Index(es):
Relevant Pages
|