Using net-ping : ping « Network « Ruby






Using net-ping


which is available as a gem with gem install net-ping


require 'rubygems'
require 'net/ping'

if Net::PingExternal.new('http://www.google.com/').ping
  puts "Pong!"
else
  puts "No response"
end

 








Related examples in the same category

1.Checking Machine and Service Availability
2.use the ping library to check servers that are online
3.Use net-ping to connect to a specific port using TCP or UDP