File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes request time out trouble Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "request time out trouble" Watch "request time out trouble" New topic

request time out trouble

sksharma sharma

Joined: Oct 08, 2004
Posts: 14
dear all ,
i have made a simple program that read the contents of an HTML page , but i am facing a small problem . the problem is, when i run the program on my system then it works properly means it shows us the contents of the desired web page, but when i run it on other system that uses different proxy then it throws error Connection timed out: connect

can any body help me out
This is the sample of my code

* Created by IntelliJ IDEA.
* User: varungoyal
* Date: Feb 9, 2006
* Time: 5:51:34 PM
* To change this template use File | Settings | File Templates.

public class SendPostRequest {
private static InputStream stream = null;
public static void main(String args[]){
public static void execute(){

try {
System.out.println("CONTROL HERE ");
URL myURL = new URL("");
HttpURLConnection urlc = (HttpURLConnection) myURL.openConnection();
System.out.println("GET RESPONSE CODE =====> "+urlc.getResponseCode());
try {
stream = urlc.getInputStream();
int size= stream.available();
while(size!=0) {
byte data[] = new byte[size];
int num_read =;
byte[] actualdata = new byte[num_read];
String webData=new String(actualdata);

if( -1) {
catch(Exception e){
System.out.println("________________ error while reading _____________________");

catch (IOException ex) {
System.out.print("ERROR IN REQUESTING URL ");


PJ Crump
Ranch Hand

Joined: Feb 06, 2002
Posts: 51
If you were using HttpClient then you would just say
I agree. Here's the link:
subject: request time out trouble
jQuery in Action, 3rd edition