Operating System - HP-UX
1830081 Members
2459 Online
109998 Solutions
New Discussion

Retrieve contents of URL.

 
Brian Keenan
Advisor

Retrieve contents of URL.

Running attached Java script produces following error

Starting...
Openning URL connection (http://www.google.co.uk/index.html:8888)
Connecting to URL
java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.(Unknown Source)
at java.net.Socket.(Unknown Source)
at sun.net.NetworkClient.doConnect(NetworkClient.java:50)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:335)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:521)
at sun.net.www.http.HttpClient.(HttpClient.java:271)
at sun.net.www.http.HttpClient.(HttpClient.java:281)
at sun.net.www.http.HttpClient.New(HttpClient.java:293)
at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:407)
at URLTest.(URLTest.java:14)
at URLTest.main(URLTest.java:43)


Any help would be appreciated
8 REPLIES 8
Ralph Grothe
Honored Contributor

Re: Retrieve contents of URL.

I am no Java hacker, so I cannot advice you on language issues.
I can only see from your stack trace dump that the exception threw that your java prog is trying to connect on port 8888.
When I try to connect to the URL on that port I get the dreaded 400 Server Error.
I think there is no http server listening on that port.
Maybe you should try to call a method that assigns the propper port (presumably 80) to your socket?
Madness, thy name is system administration
Ralph Grothe
Honored Contributor

Re: Retrieve contents of URL.

Sorry, it was of course the 404.
But maybe just a wrong concatenation?
Wasn't it
protocol://host.domain:port/document
?
Madness, thy name is system administration
James Beamish-White
Trusted Contributor

Re: Retrieve contents of URL.

Hiya,

The bad news - your code runs fine for me :-)

So, 2 things:

1)
I agree with above re: the 8888 thing - the URL string should be http://www.google.co.uk/index.html, or if you are getting even more specific, http://www.google.co.uk:80/index.html. If you are not hard coding this string into your program then you need to find out why it's trying that :8888 thing at the end.

2)
You're behind a firewall maybe? If you are, this will not work, but you may want to try and point your test script to an internal web server to prove to yourself the program works.

Cheers!
James
GARDENOFEDEN> create light
Brian Keenan
Advisor

Re: Retrieve contents of URL.

Hi,

Error should have read
http://www.google.co.uk/index.html
8888 was the result of a previous trial, and is not hard coded in attached java script.
I'm currently trying to access an intranet URL to check if it is a proxy issue?

regards

Brian
Brian Keenan
Advisor

Re: Retrieve contents of URL.

Intranet URL worked fine.
Does anyone know of an equivalent to NTLM or auto bypass proxy such as winsock for NT?

regards

Brian
Brian Keenan
Advisor

Re: Retrieve contents of URL.

Has anyone used NTLM auth module for Apache/Unix ?
James Beamish-White
Trusted Contributor

Re: Retrieve contents of URL.

Brian Keenan
Advisor

Re: Retrieve contents of URL.

Has anyone successfully installed NTLM auth module for Apache/Unix on HP.

regards

Brian