Question :
I am trying to read from a URL and display the contents in an Applet. I am using URL,HttpURLConnection classes. I am consistently getting Connection time out Exception. I am unable to connect. Could any one help me out with this. I have tried some TimeOut handler classes available on the net but still I am getting the same Exception. Please provide your comments if you have come across similar problems before.
Here is the code Iam using
url = new URL((URL)null, str, new HttpTimeoutHandler(15000)); // timeout value in milliseconds
HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
httpConnection.connect();
nputStream is = httpConnection.getInputStream();
Solution;
connection timeouts occur when:
the IP address for the requested server is successfully found connection establishment packets are dispatched to the IP address the destination address deliberately ignores or does not receive them
similar to connection timeout is Connection Refused, but in this case the destination system is actually sending packets back saying "go away, there is no service running on the port you are trying to connect to"
your packets are just being lost.. either the system or some intermediate system is firewalled. follow CMA's advice.. if you cant connect using telnet, a browser or some other app, its a network problem, not a java one
I am trying to read from a URL and display the contents in an Applet. I am using URL,HttpURLConnection classes. I am consistently getting Connection time out Exception. I am unable to connect. Could any one help me out with this. I have tried some TimeOut handler classes available on the net but still I am getting the same Exception. Please provide your comments if you have come across similar problems before.
Here is the code Iam using
url = new URL((URL)null, str, new HttpTimeoutHandler(15000)); // timeout value in milliseconds
HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
httpConnection.connect();
nputStream is = httpConnection.getInputStream();
Solution;
connection timeouts occur when:
the IP address for the requested server is successfully found connection establishment packets are dispatched to the IP address the destination address deliberately ignores or does not receive them
similar to connection timeout is Connection Refused, but in this case the destination system is actually sending packets back saying "go away, there is no service running on the port you are trying to connect to"
your packets are just being lost.. either the system or some intermediate system is firewalled. follow CMA's advice.. if you cant connect using telnet, a browser or some other app, its a network problem, not a java one
No comments:
Post a Comment
Please Provide your feedback here