类 NetUtils


  • public class NetUtils
    extends Object
    IP and Port Helper for RPC
    • 构造器详细资料

      • NetUtils

        public NetUtils()
    • 方法详细资料

      • getRandomPort

        public static int getRandomPort()
      • getAvailablePort

        public static int getAvailablePort()
      • getAvailablePort

        public static int getAvailablePort​(int port)
      • isInvalidPort

        public static boolean isInvalidPort​(int port)
      • isValidAddress

        public static boolean isValidAddress​(String address)
      • isLocalHost

        public static boolean isLocalHost​(String host)
      • isAnyHost

        public static boolean isAnyHost​(String host)
      • isInvalidLocalHost

        public static boolean isInvalidLocalHost​(String host)
      • isValidLocalHost

        public static boolean isValidLocalHost​(String host)
      • getLocalHost

        public static String getLocalHost()
      • filterLocalHost

        public static String filterLocalHost​(String host)
      • getLocalAddress

        public static InetAddress getLocalAddress()
        Find first valid IP from local network card
        返回:
        first valid local IP
      • getHostName

        public static String getHostName​(String address)
      • getIpByHost

        public static String getIpByHost​(String hostName)
        参数:
        hostName -
        返回:
        ip address or hostName if UnknownHostException