• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Slowly responding webpage and socket timeout

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey!

I need to make a head request to different web pages. some respond relatively slowly (1-2 seconds) and so I don't get any results when trying to read them. I create the connection via sockets as UrlConnection doesn't support HEAD requests and apache commons httpclient library is little bit overhead for this project.

Here is my code:


The host and port variables are set properly. As you can see I have already set the socket timeout to 50 sec. which is very high and no method invocation has ever needed more than 4 secs.

So on most urls I get correct HTTP Headers but on some slower pages I don't get any results. How can I tell my code to wait for a few secs. until the response comes?

Thanks!!

Jakob
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Isn't socket timeout what you want?
You have already specified socket timeout, why dont you increase the same. Obviously, you should do this if you desperately want the response from those pages! It will not ensure that you will always get a response but will increase the probability. This is the best a client can do.
 
Peter Wolfenstein
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I set my timeout to 50 sec. however one method invocation takes not even a second so something must be wrong then. Can't a set something like a read timeout?!

Jakob
reply
    Bookmark Topic Watch Topic
  • New Topic