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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckVitality(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:
truewhenhostis reachable onportwithin the giventimeoutandfalsein all other cases.- Throws:
IOExceptionSocketTimeoutException
-