You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by lapson lee <la...@hotmail.com> on 2005/05/31 19:42:30 UTC

Urgent: how to detect client has closed connection

Hey guys,

I have a problem right now. I wrote a Jsp page to keep sending data to 
client browser. However, no exception was thrown when I use out.print() to 
send something to client even after client has closed his web browser. My 
question is how can i know his browser is closed, so I can stop sending.
Also, from the tomcat logs, the "reset by peer" socket exception was thrown 
by Tomcat. however, seems i don't have a way to catch it.

Can anybody help me with this one... I will be really thankful to any help 
from you.

Thanks,
Luke

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Urgent: how to detect client has closed connection

Posted by Ronald Klop <ro...@base.nl>.
Sorry,

But I have no more suggestions. I would have to debug it myself than and don't have the time for that. Maybe somebody else on the list can tell you more. Maybe posting some snippets of code helps.

Ronald.

On Thu Jun 02 22:25:12 CEST 2005 lapson lee <la...@hotmail.com> wrote:
> Hey Ronald,
> 
> Thanks for your help. I checked the code. I use default out.. and it indeed 
> was using javax.servlet.jsp.JspWriter, but it does not throw an IOException. 
> Do you know why?
> 
> Thanks in advance...
> 
> Luke
> 
> 
> 
> 
> >From: Ronald Klop <ro...@base.nl>
> >Reply-To: "Tomcat Users List" <to...@jakarta.apache.org>
> >To: Tomcat Users List <to...@jakarta.apache.org>
> >Subject: Re: Urgent: how to detect client has closed connection
> >Date: Wed, 1 Jun 2005 14:14:08 +0200 (CEST)
> >
> >What Writer are you using? If you do response.getWriter() you will get a 
> >PrintWriter and the docs tell you that PrintWriter doesn't throw 
> >exceptions, so your app keeps printing to the writer after an error. (A 
> >closed connection is an IOException.)
> >If you use the default out property of a jsp page you get a JspWriter which 
> >does throw exeptions on error.
> >
> >Ronald.
> >
> >On Tue May 31 19:42:30 CEST 2005 Tomcat Users List 
> ><to...@jakarta.apache.org> wrote:
> >>Hey guys,
> >>
> >>I have a problem right now. I wrote a Jsp page to keep sending data to 
> >>client browser. However, no exception was thrown when I use out.print() to 
> >>send something to client even after client has closed his web browser. My 
> >>question is how can i know his browser is closed, so I can stop sending.
> >>Also, from the tomcat logs, the "reset by peer" socket exception was 
> >>thrown by Tomcat. however, seems i don't have a way to catch it.
> >>
> >>Can anybody help me with this one... I will be really thankful to any help 
> >>from you.
> >>
> >>Thanks,
> >>Luke
> >>
> >>_________________________________________________________________
> >>Express yourself instantly with MSN Messenger! Download today it's FREE! 
> >>http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >>
> >
> 
> _________________________________________________________________
> Don't just search. Find. Check out the new MSN Search! 
> http://search.msn.com/
> 


Re: Urgent: how to detect client has closed connection

Posted by lapson lee <la...@hotmail.com>.
Hey Ronald,

Thanks for your help. I checked the code. I use default out.. and it indeed 
was using javax.servlet.jsp.JspWriter, but it does not throw an IOException. 
Do you know why?

Thanks in advance...

Luke




>From: Ronald Klop <ro...@base.nl>
>Reply-To: "Tomcat Users List" <to...@jakarta.apache.org>
>To: Tomcat Users List <to...@jakarta.apache.org>
>Subject: Re: Urgent: how to detect client has closed connection
>Date: Wed, 1 Jun 2005 14:14:08 +0200 (CEST)
>
>What Writer are you using? If you do response.getWriter() you will get a 
>PrintWriter and the docs tell you that PrintWriter doesn't throw 
>exceptions, so your app keeps printing to the writer after an error. (A 
>closed connection is an IOException.)
>If you use the default out property of a jsp page you get a JspWriter which 
>does throw exeptions on error.
>
>Ronald.
>
>On Tue May 31 19:42:30 CEST 2005 Tomcat Users List 
><to...@jakarta.apache.org> wrote:
>>Hey guys,
>>
>>I have a problem right now. I wrote a Jsp page to keep sending data to 
>>client browser. However, no exception was thrown when I use out.print() to 
>>send something to client even after client has closed his web browser. My 
>>question is how can i know his browser is closed, so I can stop sending.
>>Also, from the tomcat logs, the "reset by peer" socket exception was 
>>thrown by Tomcat. however, seems i don't have a way to catch it.
>>
>>Can anybody help me with this one... I will be really thankful to any help 
>>from you.
>>
>>Thanks,
>>Luke
>>
>>_________________________________________________________________
>>Express yourself instantly with MSN Messenger! Download today it's FREE! 
>>http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Urgent: how to detect client has closed connection

Posted by Ronald Klop <ro...@base.nl>.
What Writer are you using? If you do response.getWriter() you will get a PrintWriter and the docs tell you that PrintWriter doesn't throw exceptions, so your app keeps printing to the writer after an error. (A closed connection is an IOException.)
If you use the default out property of a jsp page you get a JspWriter which does throw exeptions on error.

Ronald.

On Tue May 31 19:42:30 CEST 2005 Tomcat Users List <to...@jakarta.apache.org> wrote:
> Hey guys,
> 
> I have a problem right now. I wrote a Jsp page to keep sending data to 
> client browser. However, no exception was thrown when I use out.print() to 
> send something to client even after client has closed his web browser. My 
> question is how can i know his browser is closed, so I can stop sending.
> Also, from the tomcat logs, the "reset by peer" socket exception was thrown 
> by Tomcat. however, seems i don't have a way to catch it.
> 
> Can anybody help me with this one... I will be really thankful to any help 
> from you.
> 
> Thanks,
> Luke
> 
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE! 
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>