KoRnE
KoRnE

Reputation: 31

java opening urls with proxy taking very much time

Im working with java, specifically reading content from web pages, so the thing is that when I open a url using a proxy setting, it takes a lot of time in some cases (up to 15 or 20 secs) and sometimes the same url opens a lot faster (5 to 10 secs), this happens for some urls. If I dont use the proxy setting the urls open normally (2 to 5 secs).

Do you know why is this happenind and what can be done? Here is the part of the code

   //set the proxy
    System.setProperty("http.proxyHost", "web-proxy.xxx.xx.com");
    System.setProperty("http.proxyPort", "xxxx");

   //open url stream, this line is taking a lot of time with proxy...
   BufferedReader is = new BufferedReader(new InputStreamReader(url
            .openStream()));

Thanks

Upvotes: 1

Views: 464

Answers (1)

MrLolEthan
MrLolEthan

Reputation: 76

Make sure there is a good conection and transfer rate on the proxies. It all depends on what proxy you use (where it is located at).

Upvotes: 0

Related Questions