Hi,
We can ping a host using commands on console; but some time in our apps we need to confirm the host connectivity specially in REST kind of works. So, we need to do the following to ascertain network connectivity.
require 'ping'
Ping.pingecho(url_host, timeout, url_port)
It returns boolean value. In case of false state, it will keep on pinging within specified timeout. You can ping to a particular service on a particular port, but that is optional.
Cheers
Alok Anand