Also, if you're not concerned about the possibility of transmission 
stopping part way through a response, you can do

if select([sock],nil,nil,1.5)
  result = sock.gets
else
  puts "I timed out!"
end
-- 
Posted via http://www.ruby-forum.com/.