import java.net.*;
import java.io.*;
public class URLReader {
public static void main(String[] args) throws Exception {
URL yahoo = new URL("http://www.yahoo.com/");
BufferedReader in = new BufferedReader(
new InputStreamReader(
yahoo.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}
It works well on my home computer, but on my company's computer I get the
following error:
[c:\diskcopy]java URLReader
Exception in thread "main" java.net.NoRouteToHostException: Operation timed
out:
no further information
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:125)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:112)
at java.net.Socket.<init>(Socket.java:269)
at java.net.Socket.<init>(Socket.java:98)
at sun.net.NetworkClient.doConnect(NetworkClient.java:54)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:320)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:431)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:260)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:270)
at sun.net.www.http.HttpClient.New(HttpClient.java:282)
at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
.java:372)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:457)
at java.net.URL.openStream(URL.java:818)
at URLReader.main(URLReader.java, Compiled Code)
I suspect this is due to a firewall.
Does anyone know to overcome this problem?
A. Trux
[snip]
> [c:\diskcopy]java URLReader
> Exception in thread "main" java.net.NoRouteToHostException: Operation timed
> out:
> no further information
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
There are a number of undocumented system properties for this. I don't
have my code handy, but IIRC the names are
http.proxyServer
http.proxyPort
--
Justin Couch Author, Java Hacker
http://www.vlc.com.au/~justin/ Java 3D FAQ Maintainer
http://www.j3d.org/ J3D.org The Java 3D Community Site
-------------------------------------------------------------------
"Humanism is dead. Animals think, feel; so do machines now.
Neither man nor woman is the measure of all things. Every organism
process data according to its domain, its environment; you, with
all your brains, would be useless in a mouse's universe..."
- Greg Bear, Slant
-------------------------------------------------------------------