public class IPNetworkUtils extends Object
Static helper methods for network operations
Constructor and Description |
---|
IPNetworkUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isHostReachable(String host,
int timeOut)
Resolves hostname and check if accessible with
InetAddress.isReachable(int) |
static boolean |
isHostReachable(String host,
int port,
int timeOut)
Resolves hostname and check if accessible on specified port
|
static boolean |
isNetworkUp() |
static InetAddress[] |
resolveAll(String host,
int timeOut)
Resolves hostname to its IP address(s) unless the time out
|
static InetAddress |
resolveHost(String host,
int timeOut)
Resolves hostname to its IP address unless the timeout delay is reached
|
public static boolean isNetworkUp()
public static InetAddress[] resolveAll(String host, int timeOut) throws UnknownHostException
host
- Host name to resolvetimeOut
- Timeout duration in millisecondsUnknownHostException
- if no address are known for this hostpublic static InetAddress resolveHost(String host, int timeOut) throws UnknownHostException
host
- Host name to resolvetimeOut
- Timeout duration in millisecondsUnknownHostException
public static boolean isHostReachable(String host, int timeOut) throws UnknownHostException, IOException
InetAddress.isReachable(int)
host
- Host name to resolve and test for reachabilitytimeOut
- Timeout duration in millisecondsUnknownHostException
IOException
public static boolean isHostReachable(String host, int port, int timeOut) throws UnknownHostException, IOException
host
- Host name to resolve and test for reachabilityport
- TCP port to connect totimeOut
- Timeout duration in millisecondsUnknownHostException
IOException
Copyright © 2016 Sensia Software LLC. All rights reserved.