[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

force timeout net/http

Alfonso Caponi

7/17/2008 8:23:00 AM

Hi List,

I'm using net/http module to connect to a list of hosts.
How can I force to connect to next host of the list after a timeout?

http.open_timeout = timeout
http.read_timeout = timeout

This doesn't works! :(

Thank you list,
Al
--
Posted via http://www.ruby-....

1 Answer

Roger Pack

7/18/2008 12:33:00 AM

0

Alfonso Caponi wrote:
> Hi List,
>
> I'm using net/http module to connect to a list of hosts.
> How can I force to connect to next host of the list after a timeout?
>
> http.open_timeout = timeout
> http.read_timeout = timeout
>
> This doesn't works! :(
>
> Thank you list,
> Al

If the problem is that it stalls in DNS resolution then
require 'resolv-replace' might help.
Surrounding your call with
require 'timeout'
begin
Timeout::timeout(seconds_to_timeout) { call here } # might work.
rescue Timeout::Error
end
-R
--
Posted via http://www.ruby-....