Class: OpenHAB::Core::Actions::Ping

Inherits:
Object
  • Object
show all
Defined in:
lib/openhab/core/actions/ping.rb

Overview

Class Method Summary collapse

Class Method Details

.check_vitality(host, port = nil, timeout = nil) ⇒ true, false

Checks the vitality of host.

If port is nil, a regular ping is issued. If other ports are specified we try to open a new Socket with the given timeout.

Parameters:

  • host (String)
  • port (int, nil) (defaults to: nil)
  • timeout (Duration, Integer, nil) (defaults to: nil)

    Connect timeout (in milliseconds, if given as an Integer)

Returns:

  • (true, false)


20
21
22
23
24
25
# File 'lib/openhab/core/actions/ping.rb', line 20

def check_vitality(host, port = nil, timeout = nil)
  port ||= 0
  timeout ||= 0
  timeout = timeout.to_millis if timeout.is_a?(Duration)
  checkVitality(host, port, timeout)
end