From: Joseph McDonald Date: 2001-08-08T11:36:58+09:00 Subject: [ruby-talk:19322] timeout blocks Hi, I have a bit of a chicken and egg problem here. I want to use timeout to initiate a socket connection, but have a timeout on the connection. However if I use Timeout, the socket is out of scope by the time I get connected. Can I somehow declare "s" as a socket above without trying to connect? begin timeout(5) do s = TCPSocket.new(host, port) end rescue TimeoutError puts "failed initial connect, retrying..." retry rescue puts "failed #{$!}... retrying" retry end # s is no longer available here. thanks, -joe