Cory Cory <cg821105 / ohio.edu> writes:

> Does anyone know a way to test to see if the computer is connected to
> the internet in Ruby?
>
> I wrote a Ruby program with WWW::Mechanize, but it completely hangs Ruby
> when my internet is turned off.  Because Ruby does not use system
> threading, there is no way to check for a timeout when WWW::Mechanizer
> freezes due to not having an internet connection.

       require 'ping'
       Ping.pingecho("google.com",10,80) # --> true or false

-- 
__Pascal Bourguignon__