/** * Returns all the host names associated by the default nameserver with the * address bound to the specified network interface * * @param strInterface * The name of the network interface to query (e.g. eth0) * @return The list of host names associated with IPs bound to the network * interface * @throws UnknownHostException * If one is encountered while querying the default interface * */ public static String[] getHosts(String strInterface) throws UnknownHostException { return getHosts(strInterface, null, false); }
/** * Returns the default (first) host name associated by the provided * nameserver with the address bound to the specified network interface * * @param strInterface * The name of the network interface to query (e.g. eth0) * @param nameserver * The DNS host name * @return The default host names associated with IPs bound to the network * interface * @throws UnknownHostException * If one is encountered while querying the default interface */ public static String getDefaultHost(@Nullable String strInterface, @Nullable String nameserver, boolean tryfallbackResolution) throws UnknownHostException { if (strInterface == null || "default".equals(strInterface)) { return cachedHostname; } if (nameserver != null && "default".equals(nameserver)) { nameserver = null; } String[] hosts = getHosts(strInterface, nameserver, tryfallbackResolution); return hosts[0]; }
/** * Returns all the host names associated by the default nameserver with the * address bound to the specified network interface * * @param strInterface * The name of the network interface to query (e.g. eth0) * @return The list of host names associated with IPs bound to the network * interface * @throws UnknownHostException * If one is encountered while querying the default interface * */ public static String[] getHosts(String strInterface) throws UnknownHostException { return getHosts(strInterface, null, false); }
/** * Returns all the host names associated by the default nameserver with the * address bound to the specified network interface * * @param strInterface * The name of the network interface to query (e.g. eth0) * @return The list of host names associated with IPs bound to the network * interface * @throws UnknownHostException * If one is encountered while querying the default interface * */ public static String[] getHosts(String strInterface) throws UnknownHostException { return getHosts(strInterface, null); }
/** * Returns all the host names associated by the default nameserver with the * address bound to the specified network interface * * @param strInterface * The name of the network interface to query (e.g. eth0) * @return The list of host names associated with IPs bound to the network * interface * @throws UnknownHostException * If one is encountered while querying the default interface * */ public static String[] getHosts(String strInterface) throws UnknownHostException { return getHosts(strInterface, null); }
/** * Returns all the host names associated by the default nameserver with the * address bound to the specified network interface * * @param strInterface * The name of the network interface to query (e.g. eth0) * @return The list of host names associated with IPs bound to the network * interface * @throws UnknownHostException * If one is encountered while querying the deault interface * */ public static String[] getHosts(String strInterface) throws UnknownHostException { return getHosts(strInterface, null); }
/** * Returns all the host names associated by the default nameserver with the * address bound to the specified network interface * * @param strInterface * The name of the network interface to query (e.g. eth0) * @return The list of host names associated with IPs bound to the network * interface * @throws UnknownHostException * If one is encountered while querying the default interface * */ public static String[] getHosts(String strInterface) throws UnknownHostException { return getHosts(strInterface, null); }
/** * Returns all the host names associated by the default nameserver with the * address bound to the specified network interface * * @param strInterface * The name of the network interface to query (e.g. eth0) * @return The list of host names associated with IPs bound to the network * interface * @throws UnknownHostException * If one is encountered while querying the deault interface * */ public static String[] getHosts(String strInterface) throws UnknownHostException { return getHosts(strInterface, null); }
/** * Returns the default (first) host name associated by the provided * nameserver with the address bound to the specified network interface * * @param strInterface * The name of the network interface to query (e.g. eth0) * @param nameserver * The DNS host name * @return The default host names associated with IPs bound to the network * interface * @throws UnknownHostException * If one is encountered while querying the deault interface */ public static String getDefaultHost(String strInterface, String nameserver) throws UnknownHostException { if (strInterface.equals("default")) return InetAddress.getLocalHost().getCanonicalHostName(); if (nameserver != null && nameserver.equals("default")) return getDefaultHost(strInterface); String[] hosts = getHosts(strInterface, nameserver); return hosts[0]; }
/** * Returns the default (first) host name associated by the provided * nameserver with the address bound to the specified network interface * * @param strInterface * The name of the network interface to query (e.g. eth0) * @param nameserver * The DNS host name * @return The default host names associated with IPs bound to the network * interface * @throws UnknownHostException * If one is encountered while querying the deault interface */ public static String getDefaultHost(String strInterface, String nameserver) throws UnknownHostException { if (strInterface.equals("default")) return InetAddress.getLocalHost().getCanonicalHostName(); if (nameserver != null && nameserver.equals("default")) return getDefaultHost(strInterface); String[] hosts = getHosts(strInterface, nameserver); return hosts[0]; }
/** * Returns the default (first) host name associated by the provided * nameserver with the address bound to the specified network interface * * @param strInterface * The name of the network interface to query (e.g. eth0) * @param nameserver * The DNS host name * @return The default host names associated with IPs bound to the network * interface * @throws UnknownHostException * If one is encountered while querying the default interface */ public static String getDefaultHost(String strInterface, String nameserver) throws UnknownHostException { if ("default".equals(strInterface)) { return cachedHostname; } if ("default".equals(nameserver)) { return getDefaultHost(strInterface); } String[] hosts = getHosts(strInterface, nameserver); return hosts[0]; }
/** * Returns the default (first) host name associated by the provided * nameserver with the address bound to the specified network interface * * @param strInterface * The name of the network interface to query (e.g. eth0) * @param nameserver * The DNS host name * @return The default host names associated with IPs bound to the network * interface * @throws UnknownHostException * If one is encountered while querying the default interface */ public static String getDefaultHost(String strInterface, String nameserver) throws UnknownHostException { if ("default".equals(strInterface)) { return cachedHostname; } if ("default".equals(nameserver)) { return getDefaultHost(strInterface); } String[] hosts = getHosts(strInterface, nameserver); return hosts[0]; }
/** * Returns the default (first) host name associated by the provided * nameserver with the address bound to the specified network interface * * @param strInterface * The name of the network interface to query (e.g. eth0) * @param nameserver * The DNS host name * @return The default host names associated with IPs bound to the network * interface * @throws UnknownHostException * If one is encountered while querying the default interface */ public static String getDefaultHost(String strInterface, String nameserver) throws UnknownHostException { if ("default".equals(strInterface)) { return cachedHostname; } if ("default".equals(nameserver)) { return getDefaultHost(strInterface); } String[] hosts = getHosts(strInterface, nameserver); return hosts[0]; }
/** * Returns the default (first) host name associated by the provided * nameserver with the address bound to the specified network interface * * @param strInterface * The name of the network interface to query (e.g. eth0) * @param nameserver * The DNS host name * @return The default host names associated with IPs bound to the network * interface * @throws UnknownHostException * If one is encountered while querying the default interface */ public static String getDefaultHost(@Nullable String strInterface, @Nullable String nameserver, boolean tryfallbackResolution) throws UnknownHostException { if (strInterface == null || "default".equals(strInterface)) { return cachedHostname; } if (nameserver != null && "default".equals(nameserver)) { nameserver = null; } String[] hosts = getHosts(strInterface, nameserver, tryfallbackResolution); return hosts[0]; }