Advertisement

03.12.2007 at 01:10AM PDT, ID: 22442767
[x]
Attachment Details

IOException: java.net.ConnectException: Connection timed out: connect

Asked by JianJunShen in Java Standard Edition, Programming Languages, Java Programming Language

Tags: timed, connection, out

URL yahooURL = new URL("http://www.yahoo.com");
URLConnection yahooConnection = yahoo.openConnection();

I am under companies' firewall. But if chnage URL to an internal webpage, this code works.
Do you know why?

I try to open connection like above. I got following error:
IOException: java.net.ConnectException: Connection timed out: connect
java.net.ConnectException: Connection timed out: connect
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
      at java.net.Socket.connect(Socket.java:464)
      at java.net.Socket.connect(Socket.java:414)
      at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
      at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
      at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
      at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
      at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
      at sun.net.www.http.HttpClient.New(HttpClient.java:339)
      at sun.net.www.http.HttpClient.New(HttpClient.java:320)
      at sun.net.www.http.HttpClient.New(HttpClient.java:315)
      at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:522)
      at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:499)
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:620)
      at com.nokia.ipm.test.AutomaticTest.main(AutomaticTest.java:36)

Start Free Trial
[+][-]03.12.2007 at 01:10AM PDT, ID: 18700375

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.12.2007 at 01:11AM PDT, ID: 18700377

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Java Standard Edition, Programming Languages, Java Programming Language
Tags: timed, connection, out
Sign Up Now!
Solution Provided By: CEHJ
Participating Experts: 3
Solution Grade: B
 
 
[+][-]03.12.2007 at 01:16AM PDT, ID: 18700391

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.12.2007 at 02:29AM PDT, ID: 18700571

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32