Class NetworkUtils

java.lang.Object
host.anzo.commons.utils.NetworkUtils

public class NetworkUtils extends Object
Since:
03.03.12 16:01
  • Constructor Details

    • NetworkUtils

      public NetworkUtils()
  • Method Details

    • getExternalIP

      @Nullable public static @Nullable String getExternalIP()
      Returns:
      external IP address, null if can't detect external IP
    • isLocalAddress

      public static boolean isLocalAddress(@NotNull @NotNull InetAddress address)
      Parameters:
      address - address for check
      Returns:
      true if specified address is local, false otherwise
    • isLocalAddress

      public static boolean isLocalAddress(@NotNull @NotNull String address)
      Parameters:
      address - address for check
      Returns:
      true if specified address is local, false otherwise
    • isValidIp

      public static boolean isValidIp(String ip)
      Parameters:
      ip - ip to check
      Returns:
      true if specified IP is valid, false otherwise
    • isPortFree

      public static boolean isPortFree(int port)
      Parameters:
      port - port to check
      Returns:
      true if port is free, false otherwise