com.kuka.common
Class NetUtil

java.lang.Object
  extended by com.kuka.common.NetUtil

public final class NetUtil
extends Object

A class that implements some common used classes for network interfaces.

This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

Method Summary
static List<InetAddress> determineAddresses()
          Determines all address on all network interfaces of the PC.
static List<Inet4Address> getLocalIPAdresses()
          Gets all IP-addresses of the local system.
static Inet4Address getMatchingLocalIPAdress(List<Inet4Address> availableAddresses, String remoteAddress, String netmask)
          Gets a specific IP-address of the local system.
static boolean isLocalHost(String ipAdress)
          Returns true if the specified IP address is a local host address.
static boolean isReachable(String ip, int timeout)
          Deprecated. Set to deprecated because this method does not work properly in Windows! (see bug 11950)
static boolean isReachableByNetworkSharePort(String host, int timeout)
          Indicates whether the specified host is reachable (ping) by Server Message Block (SMB) TCP port 445, used for network file sharing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isReachable

@Deprecated
public static boolean isReachable(String ip,
                                             int timeout)
Deprecated. Set to deprecated because this method does not work properly in Windows! (see bug 11950)

Indicates whether the specified IP address is reachable (ping) or not.

Parameters:
ip - IP address to check.
timeout - timeout for the check
Returns:
true if IP address is reachable.

isReachableByNetworkSharePort

public static boolean isReachableByNetworkSharePort(String host,
                                                    int timeout)
Indicates whether the specified host is reachable (ping) by Server Message Block (SMB) TCP port 445, used for network file sharing.

Parameters:
host - host name or IP address to check.
timeout - timeout for the check in milliseconds
Returns:
true if the host is reachable.

determineAddresses

public static List<InetAddress> determineAddresses()
                                            throws Exception
Determines all address on all network interfaces of the PC. Includes localhost if no other IP was found.

Returns:
The list of all IPs.
Throws:
Exception - If an error occurs.

getMatchingLocalIPAdress

public static Inet4Address getMatchingLocalIPAdress(List<Inet4Address> availableAddresses,
                                                    String remoteAddress,
                                                    String netmask)
                                             throws SocketException
Gets a specific IP-address of the local system. The IP-address must be compatible with the specified remote address and the network mask.

Parameters:
availableAddresses - the addresses in which the matching IP address should be searched for.
remoteAddress - remote IP address for compatibility check.
netmask - network mask for compatibility check.
Returns:
a compatible IP address of the local system, or null if no compatible IP address was found.
Throws:
SocketException - socket error

getLocalIPAdresses

public static List<Inet4Address> getLocalIPAdresses()
                                             throws SocketException
Gets all IP-addresses of the local system.

Returns:
all IP-addresses of the local system.
Throws:
SocketException - socket error

isLocalHost

public static boolean isLocalHost(String ipAdress)
Returns true if the specified IP address is a local host address.

Parameters:
ipAdress - the IP address that should be checked if it is the local host
Returns:
true if the specified IP address is a local host address


Copyright © 2019. All rights reserved.