require 'timeout'
require 'socket'

timeout(20) {
    s = Socket::TCPSocket.new('google.com', 80)
    [...]
}


Lennon Day-Reynolds
lennon / day-reynolds.com

Austin Ziegler wrote:

>I'm working with some RSS stuff, including the Python RSS validator 
>(Ruby & Pilgrim, at http://feeds.archive.org/). One of the things 
>used in this validator is the Python TimeoutSocket by 
><timo / alum.mit.edu>, which shims the Python socket to provide a 
>timeout for all sockets. Looking around, it doesn't seem that Ruby 
>has anything similar (at least not in base). What would it take to 
>add this to base?
>
>-austin
>-- Austin Ziegler, austin / halostatue.ca on 2003.03.12 at 15:18:07
>
>
>
>
>  
>