Put  the in.close statement outside the while loop ....  and you'll be up and
running again.


Yang XIAO wrote:

> Hi, Craig
>
> thanks for the reply. I excuted URLReader class:
>
> import java.io.*;
> import java.net.*;
>
> public class URLReader {
>         public static void main(String[] args) throws Exception {
>                 URL php = new URL("http://www.php.net/");
>                 BufferedReader in = new BufferedReader(
>                                         new InputStreamReader(
>                                                 php.openStream()));
>                 String inputLine;
>
>                 while((inputLine = in.readLine()) != null) {
>                         System.out.println(inputLine);
>                         in.close();
>                 }
>         }
> }
>
> but I got
> <HTML>
> java.io.IOException: Stream closed
>         at java.io.BufferedReader.readLine(BufferedReader.java)
>         at URLReader.main(URLReader.java:14)
>
> Can you please tell me why?
>
> sorry it's out of question. But really appreciate your instruction.
> Stella
>
> > > Hi, there
> > >
> > > I'm developing a servlet to get data from a web server. Please does
> >anyone
> > > know a method which can simulate the following command:
> > >
> > > telnet server:port
> > > GET https://requestmessage
> > >
> >
> >See the class java.net.URLConnection.  There's some good examples of using
> >this
> >in the Java Language Tutorial at (http://java.sun.com/docs/books/tutorial)
> >--
> >see the Networking trail.
> >
> > >
> > > thanks in advance
> > > Stella
> > >
> >
> >Craig McClanahan
> >
> >___________________________________________________________________________
> >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 Email at http://www.hotmail.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
begin:vcard
n:Asthana;Rishi
tel;fax:1-732-548-4009
tel;home:1-732-635-3597
tel;work:1-732-548-0087
x-mozilla-html:FALSE
org:NetCom Systems, Inc;Software Development
adr:;;116,Copperfield Ln                ;Metuchen;NJ;08840;USA
version:2.1
email;internet:[EMAIL PROTECTED]
title:Systems Consultant
x-mozilla-cpt:;-3936
fn:Rishi Asthana
end:vcard

Reply via email to