Re: Detecting clsoed socket on OutputStream.Write
- From: Knute Johnson <nospam@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 29 Jun 2006 22:25:50 -0700
EJP wrote:
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.
That's why the read throws an exception immediately then, the outgoing data is locally buffered? How long will the local data be buffered? Does not the flush() cause it to go now?
Thanks,
--
Knute Johnson
email s/nospam/knute/
.
- Follow-Ups:
- References:
- Detecting clsoed socket on OutputStream.Write
- From: david . topham
- Re: Detecting clsoed socket on OutputStream.Write
- From: Knute Johnson
- Re: Detecting clsoed socket on OutputStream.Write
- From: EJP
- Detecting clsoed socket on OutputStream.Write
- Prev by Date: Re: JSP and Java Swings reuse of code
- Next by Date: Re: Big Huge OS Project!!! Need help!!
- Previous by thread: Re: Detecting clsoed socket on OutputStream.Write
- Next by thread: Re: Detecting clsoed socket on OutputStream.Write
- Index(es):
Relevant Pages
|
|