Use net-ping to connect to a specific port using TCP or UDP : ping « Network « Ruby






Use net-ping to connect to a specific port using TCP or UDP



require 'rubygems'
require 'net/ping'

if Net::PingTCP.new('http://www.google.com/', 80).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.Using net-ping