>From my experience with sockets, the input stream and output stream are
probably
tied to the same socket, and closing the input closes the output too.  Then,
when
you close the output yourself, you get the exception.

Solution -- let the base class close the streams.

Duane Morse, Eldorado Computing Inc., Phoenix AZ


-----Original Message-----
From: James Knowles [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 14, 2000 9:48 AM
To: [EMAIL PROTECTED]
Subject: Re: HANDLER THREAD PROBLEM: java.io.IOException: Socket Closed


I am also getting this... does anybody know how to catch this exception...

This is my code that give this error on the console ... ( I am on NT as well
(please forgive me... ))

import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;


public class readand extends HttpServlet {



public void doGet(HttpServletRequest request,HttpServletResponse response)
throws IOException, ServletException
    {

        response.setContentType("text/html");
   PrintWriter out = response.getWriter();
try {
       URL url = new URL("http://www.laserrec.co.uk/Default.asp");
       BufferedReader in = new BufferedReader(new
InputStreamReader(url.openStream()));

 int countit = -1;
 String str;
 while ((str = in.readLine()) != null) {
 out.println(str + "\n");
 }
 in.close();
 } catch (MalformedURLException e) {
 }
 catch (IOException e) {
 out.println("<br>The webserver is down");
 out.println(e);
 }

    }
}

When it returns the page correctly I get all of the java.io.IOExceptions
even though I thought I would have caught them all with catch (IOException
e)

Hope this helps explain a bit more of the problem ...

James

----- Original Message -----
From: "[Andrew Fairburn]" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 14, 2000 3:57 PM
Subject: HANDLER THREAD PROBLEM: java.io.IOException: Socket Closed


> Hello,
> I'm using jswdk-1.0.1 on NT and keep getting this exception. Does anyone
> know what is causing this - or even suggest something. I've searched the
> archives/ and the web but have been unable to resolve it. Thanks,
> Andy
>
>
> HANDLER THREAD PROBLEM: java.io.IOException: Socket Closed
> java.io.IOException: Socket Closed
>         at
java.net.PlainSocketImpl.getInputStream(PlainSocketImpl.java:421)
>         at java.net.Socket$1.run(Socket.java:335)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.Socket.getInputStream(Socket.java:332)
>         at
> com.sun.web.server.ConnectionHandler.run(ConnectionHandler.java:161)
>
>
>
> Andrew Fairburn
> Vodafone Multimedia Ltd
> Tel: 01635-685841
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to