Class Ping
java.lang.Object
org.openhab.core.model.script.actions.Ping
This Action checks the vitality of the given host.
- Author:
- Thomas Eichstaedt-Engelen - Initial contribution, Kai Kreuzer - Initial contribution
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkVitality
(String host, int port, int timeout) Checks the vitality ofhost
.
-
Constructor Details
-
Ping
public Ping()
-
-
Method Details
-
checkVitality
public static boolean checkVitality(String host, int port, int timeout) throws IOException, SocketTimeoutException Checks the vitality ofhost
. Ifport
'0' is specified (which is the default when configuring just the host), a regular ping is issued. If other ports are specified we try open a new Socket with the giventimeout
.- Parameters:
host
-port
-timeout
-- Returns:
true
whenhost
is reachable onport
within the giventimeout
andfalse
in all other cases.- Throws:
IOException
SocketTimeoutException
-