From: Douglas Seifert Date: 2009-10-03T00:30:33+09:00 Subject: Re: socket error handling... Net http --000e0cd1d4ba7bb1860474f515aa Content-Type: text/plain; charset=ISO-8859-1 > > loop { > res = > Net::HTTP.get_response(URI.parse('http://bigmac.t35.com/text.txt' > )) > print res.body > sleep 3 > } > > > this loop brakes when i get the (SocketError)... i get errors because of > bad connection to my wireless network... i dont know how to handle this > error and keep the script from crashing... > Try this: loop do begin res = Net::HTTP.get_response(URI.parse("http://bigmac.t35.com/text.txt ")) print res.body rescue SocketError => se puts "Got socket error: #{se}" end sleep 3 end --000e0cd1d4ba7bb1860474f515aa--