• Post Reply Bookmark Topic Watch Topic
  • New Topic

Slowly responding webpage and socket timeout  RSS feed

 
Peter Wolfenstein
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • 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
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!