hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: A bug?
Date Thu, 04 Sep 2003 21:45:08 GMT
Roland, Mike and all.

Not only it appears to be a reasonable order of things, it also seems to
correspond to Sun's official recommendations

...
out.close();
in.close();
...
echoSocket.close();
...
These statements close the readers and writers connected to the socket
and to the standard input stream, and close the socket connection to the
server. <Strong>The order here is important</Strong>. You should close
any streams connected to a socket before you close the socket itself.

...

Java tutorial
<http://java.sun.com/docs/books/tutorial/networking/sockets/readingWriting.html>


On Tue, 2003-09-02 at 07:19, Roland Weber wrote:
> Hello Mike,
> 
> I think closing the output stream first is the right thing to do.
> Someone might want to send a shutdown notification to the
> server before stopping to receive, e.g. for SSL connections.
> 
> regards,
>   Roland
> 
> 
> 
> 
> 
> Michael Becke <becke@u.washington.edu>
> 01.09.2003 21:16
> Please respond to "Commons HttpClient Project"
>  
>         To:     "Commons HttpClient Project" 
> <commons-httpclient-dev@jakarta.apache.org>
>         cc: 
>         Subject:        Re: A bug?
> 
> 
> Yes, this is a good point.  We might as well be as thorough as possible.
> 
> The only real change that might make sense in reversing the order in 
> which streams are closed.  Is sounds like Yue would like to have the 
> output stream closed before the input.  Anyone have objections to this?
> 
> Mike
> 
> On Monday, September 1, 2003, at 07:46 AM, Roland Weber wrote:
> 
> > Michael Becke wrote:
> >
> >> Any thoughts on why we close the streams and then the socket?
> >
> > Someone might have implemented sockets with buffered streams.
> > Closing only the socket directly would not dispose of the buffers.
> > Given the SocketFactory stuff, that possibility shouldn't be ruled out.
> >
> > just my thoughts :-)
> >   Roland
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Mime
View raw message