# Testing for timeout while downloading a website using rio

**URL:** <https://www.ruby-forum.com/t/testing-for-timeout-while-downloading-a-website-using-rio/71647>\
**Category:** Ruby\
**Created:** [October 10, 2006, 4:13pm UTC](https://www.ruby-forum.com/t/testing-for-timeout-while-downloading-a-website-using-rio/71647 "2006-10-10T16:13:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 10, 2006, 4:13pm UTC](https://www.ruby-forum.com/t/testing-for-timeout-while-downloading-a-website-using-rio/71647/1 "2006-10-10T16:13:00Z")

</div>

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
