Class: Ping
- Inherits:
-
Object
- Object
- Ping
- Defined in:
- lib/ping.rb
Class Method Summary collapse
Class Method Details
.pingecho(host, timeout = 5, service = "echo") ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ping.rb', line 5 def self.pingecho(host, timeout=5, service="echo") begin timeout(timeout) do s = TCPSocket.new(host, service) s.close end rescue Errno::ECONNREFUSED return true rescue Timeout::Error, StandardError return false end return true end |