Testing for timeout while downloading a website using rio

Dear all,

I need to download several websites from the internet using Rio.
But sometimes, these are unavailable.
Then, it takes several minutes for the program to say that the
connection timed out.
Now, I would like to start rio to download the website, but
if it is not possible to download it within, say, 30 seconds,
I would like to stop this process and try something else.

Is it possible to do this in some way, say

begin
… startcountingsomehow
rio(website)>rio(myfile)
rescue # is true after 30 seconds, say
… do something else
end

The problem is that there must be two processes (counting
time and retrieving the website) running alongside.
I would love to have an implementation of this which runs
both in Windows XP and Linux…

Thank you for your help!

Best regards,

Axel

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs