No, i tried not closing the input stream too, it gives me an error as
UnKnow Host java.net.UnknownHostException: java.sun.com, i am little bit
confused here according to the spec if there is any I/O error when you try
to construct an URL object, then there it would throw an I/O error only but
here it throws an UNKNOWNHOSTEXCEPTION error.  I tried james code with
URLCONNECTION too but returned with the same error.  But when i just
construct an URL and try to read the protocol and portnumber it works like
charm, this UNKNOWNHOSTEXCEPTION comes only for when i try to open an I/O
input.

can any1 clarify this??

>From: Duane Morse <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
>        Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: HANDLER THREAD PROBLEM: java.io.IOException: Socket Closed
>Date: Tue, 14 Nov 2000 11:09:46 -0700
>
>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

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

___________________________________________________________________________
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