• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
Bartenders:
  • Himai Minh
  • Carey Brown
  • Frits Walraven

Networking question

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to run the following program:

import java.net.*;
import java.io.*;
public class saveHTML
{
public static void main(String[] args) throws Exception
{
try {
URL js = new URL("http://www.javasoft.com/");
System.out.println(js);

InputStream is = js.openStream();

System.out.println("2");
BufferedReader in = new BufferedReader(new InputStreamReader(is));

String inputLine;
while ((inputLine = in.readLine()) != null)
{
System.out.println(inputLine);
}
in.close();
} catch (Exception e)
{
System.out.println(e);
}
}
}

Right after the URL object is created and displayed, I am getting
the following exception:
"java.net.SocketException: descriptor not a socket: no further
information"
The exception is thrown by "openStream".
Any suggestions?
Thanks,
Ed
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the system connected to the Internet when you test the program?
 
Ed Nodelman
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tony Alicea:
Is the system connected to the Internet when you test the program?


Yes, it's connected to the Internet.
Also, whats strange, I get different exceptions at home and at work. At work, I am getting UnknownHostException. Could this be
because of the firewall? At work I am using NT and I have WIN95
at home.
Thanks,
Ed
 
Ed Nodelman
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I solved the problem. The solution? Upgraded winsoc
 
reply
    Bookmark Topic Watch Topic
  • New Topic