Package uk.ac.manchester.spinnaker.utils
Class Ping
java.lang.Object
uk.ac.manchester.spinnaker.utils.Ping
public abstract class Ping extends Object
How to ping a host to test for (ICMP) network connectivity.
- Author:
- Donal Fellows
-
Method Summary
Modifier and Type Method Description static int
ping(String address)
Pings to detect if a host or IP address is reachable.static int
ping(InetAddress address)
Pings to detect if a host or IP address is reachable.
-
Method Details
-
ping
Pings to detect if a host or IP address is reachable. May wait for up to about five seconds (or longer in extremis). Technically, it only detects if a host is reachable by ICMP ECHO requests; there are environments (such as Microsoft Azure) where ICMP ECHO is blocked but it is possible to route ordinary UDP packets.- Parameters:
address
- Where should be pinged.- Returns:
- 0 on success, other values on failure (reflecting the result of the OS subprocess).
-
ping
Pings to detect if a host or IP address is reachable. May wait for up to about five seconds (or longer in extremis). Technically, it only detects if a host is reachable by ICMP ECHO requests; there are environments (such as Microsoft Azure) where ICMP ECHO is blocked but it is possible to route ordinary UDP packets.- Parameters:
address
- Where should be pinged.- Returns:
- 0 on success, other values on failure (reflecting the result of the OS subprocess).
-