Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Re: Tomcat 5 is not generating IOException when connection closes

Remy Maucherat

2004-01-08

Replies:

Paulo Pizarro wrote:
> I have a servlet with a persistent connection open to a client
> (browser), and when the browser is closed or the user hits the stop
> button, the connection is closed, but the servlet isn't throwing the
> IOException when it should do it.
> (i guess)
>
> As i could notice, after about 8k of data being written to the client
> after the connection has been closed, the serlet gets the IOException.
>
> I think that perhaps tomcat is buffering the data and only when this
> buffer is full the IOException is thrown, even when we make a explicit
> call to out.flush().
> The strange thing is that when the connection is open, the client
> receives data in real time, with no buffering or very little buffering.
>
> Has anyone ever had this problem? I tried to call the method
> response.setBufferSize(0), but it didn't work.
>
> Below is the piece of code that writes the data to the ServletOutputStream.
>
> ServletOutputStream out = response.getOutputStream();
>
> public void send(String s) throws IOException {
>               out.write(s.getBytes(), 0, s.length());
>               out.flush();
> }

I believe this works ok.

--
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
R�my Maucherat
Senior Developer & Consultant
JBoss Group (Europe) S�RL
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.