Lines Matching refs:host

69  * corresponding host name (depending on whether it is constructed
70 * with a host name or whether it has already done reverse host name
90 * interface, in case the server host has multiple interfaces.
98 * host. This address is often used when testing a
139 * one. For any host name, its corresponding IP address is returned.
142 * the host associated with the IP address is returned.
144 * <p> The InetAddress class provides methods to resolve host names to
150 * unsuccessful host name resolutions.
154 * the result of positive host name resolutions are
157 * period of time. The result of unsuccessful host
167 * positive and negative host name resolution caching:
481 * implementation to try to reach the host, but firewalls and server
486 * a TCP connection on port 7 (Echo) of the destination host.
490 * answer, the host is deemed unreachable. A negative value will result
505 * implementation to try to reach the host, but firewalls and server
510 * a TCP connection on port 7 (Echo) of the destination host.
520 * answer, the host is deemed unreachable. A negative value will result
545 * Gets the host name for this IP address.
547 * <p>If this InetAddress was created with a host name,
548 * this host name will be remembered and returned;
562 * @return the host name for this IP address, or if the operation
575 * If the host is equal to null, then this address refers to any
584 * the hostname for this IP address, i.e., to connect to the host.
588 * @return the host name for this IP address, or if the operation
612 * the hostname for this IP address, i.e., to connect to the host.
639 * the hostname for this IP address, i.e., to connect to the host.
643 * @return the host name for this IP address, or if the operation
652 String host = null;
655 host = nameService.getHostByAddr(addr.getAddress());
658 * the hostname for this IP address, ie, connect to the host
663 sec.checkConnect(host, -1);
672 InetAddress[] arr = InetAddress.getAllByName0(host, check);
683 host = addr.getHostAddress();
684 return host;
687 host = addr.getHostAddress();
689 host = addr.getHostAddress();
692 return host;
750 * If the host name is unresolved, no reverse name service lookup
761 // mapping from host name to Addresses - either NameServiceAddresses (while
779 final String host;
784 CachedAddresses(String host, InetAddress[] inetAddresses, long expiryTime) {
785 this.host = host;
793 throw new UnknownHostException(host);
815 private final String host;
818 NameServiceAddresses(String host, InetAddress reqAddr) {
819 this.host = host;
827 // for particular host at any time.
830 addresses = cache.putIfAbsent(host, this);
844 inetAddresses = getAddressesFromNameService(host, reqAddr);
854 cache.remove(host, this);
857 host,
864 if (cache.replace(host, this, cachedAddresses) &&
871 throw ex == null ? new UnknownHostException(host) : ex;
884 * NameService provides host and address lookup service
891 * Lookup a host mapping by name. Retrieve the IP addresses
892 * associated with a host
894 * @param host the specified hostname
895 * @return array of IP addresses for the requested host
897 * if no IP address for the {@code host} could be found
899 InetAddress[] lookupAllHostAddr(String host)
903 * Lookup the host corresponding to the IP address provided
906 * @return {@code String} representing the host name mapping
908 * if no host found for the specified IP address
916 * OS network libraries to resolve host address mappings.
922 public InetAddress[] lookupAllHostAddr(String host)
925 return impl.lookupAllHostAddr(host);
936 * The HostsFileNameService provides host address mapping
941 * IP Address host alias list.
974 * Lookup the host name corresponding to the IP address provided.
975 * Search the configured host file a host name corresponding to
979 * @return {@code String} representing the host name mapping
981 * if no host found for the specified IP address
986 String host = null;
995 host = extractHost(hostEntry, addrString);
996 if (host != null) {
1008 if ((host == null) || (host.equals("")) || (host.equals(" "))) {
1014 return host;
1018 * <p>Lookup a host mapping by name. Retrieve the IP addresses
1019 * associated with a host.
1022 * with the specified host name.
1024 * @param host the specified hostname
1025 * @return array of IP addresses for the requested host
1027 * if no IP address for the {@code host} could be found
1029 public InetAddress[] lookupAllHostAddr(String host)
1037 // lookup the file and create a list InetAddress for the specfied host
1043 if (hostEntry.contains(host)) {
1044 addrStr = extractHostAddr(hostEntry, host);
1051 inetAddresses.add(InetAddress.getByAddress(host, addr));
1058 throw new UnknownHostException("Unable to resolve host " + host
1065 throw new UnknownHostException("Unable to resolve host " + host
1091 /** host to ip address mapping */
1092 private String extractHostAddr(String hostEntry, String host) {
1097 // look at the host aliases
1099 if (mapping[i].equalsIgnoreCase(host)) {
1108 * IP Address to host mapping
1109 * use first host alias in list
1113 String host = null;
1117 host = mapping[1];
1120 return host;
1163 * Creates an InetAddress based on the provided host name and IP address.
1166 * <p> The host name can either be a machine name, such as
1169 * <p> No validity checking is done on the host name either.
1178 * @param host the specified host
1184 public static InetAddress getByAddress(String host, byte[] addr)
1186 if (host != null && host.length() > 0 && host.charAt(0) == '[') {
1187 if (host.charAt(host.length()-1) == ']') {
1188 host = host.substring(1, host.length() -1);
1193 return new Inet4Address(host, addr);
1198 return new Inet4Address(host, newAddr);
1200 return new Inet6Address(host, addr);
1209 * Determines the IP address of a host, given the host's name.
1211 * <p> The host name can either be a machine name, such as
1216 * <p> For {@code host} specified in literal IPv6 address,
1222 * <p> If the host is {@code null} then an {@code InetAddress}
1228 * @param host the specified host, or {@code null}.
1229 * @return an IP address for the given host name.
1231 * {@code host} could be found, or if a scope_id was specified
1236 public static InetAddress getByName(String host)
1238 return InetAddress.getAllByName(host)[0];
1242 private static InetAddress getByName(String host, InetAddress reqAddr)
1244 return InetAddress.getAllByName(host, reqAddr)[0];
1248 * Given the name of a host, returns an array of its IP addresses,
1251 * <p> The host name can either be a machine name, such as
1256 * <p> For {@code host} specified in <i>literal IPv6 address</i>,
1262 * <p> If the host is {@code null} then an {@code InetAddress}
1268 * <p> If there is a security manager and {@code host} is not
1269 * null and {@code host.length() } is not equal to zero, the
1275 * @param host the name of the host, or {@code null}.
1276 * @return an array of all the IP addresses for a given host name.
1279 * {@code host} could be found, or if a scope_id was specified
1286 public static InetAddress[] getAllByName(String host)
1288 return getAllByName(host, null);
1291 private static InetAddress[] getAllByName(String host, InetAddress reqAddr)
1294 if (host == null || host.length() == 0) {
1301 if (host.charAt(0) == '[') {
1303 if (host.length() > 2 && host.charAt(host.length()-1) == ']') {
1304 host = host.substring(1, host.length() -1);
1308 throw new UnknownHostException(host + ": invalid IPv6 address");
1312 // if host is an IP address, we won't do further lookup
1313 if (Character.digit(host.charAt(0), 16) != -1
1314 || (host.charAt(0) == ':')) {
1319 addr = IPAddressUtil.textToNumericFormatV4(host);
1324 if ((pos=host.indexOf ('%')) != -1) {
1325 numericZone = checkNumericZone (host);
1327 ifname = host.substring (pos+1);
1330 if ((addr = IPAddressUtil.textToNumericFormatV6(host)) == null && host.contains(":")) {
1331 throw new UnknownHostException(host + ": invalid IPv6 address");
1335 throw new UnknownHostException("["+host+"]");
1352 throw new UnknownHostException("["+host+"]");
1354 return getAllByName0(host, reqAddr, true, true);
1404 private static InetAddress[] getAllByName0 (String host)
1407 return getAllByName0(host, true);
1413 static InetAddress[] getAllByName0 (String host, boolean check)
1415 return getAllByName0 (host, null, check, true);
1421 * @param host host name to look up
1427 * @throws UnknownHostException if host name is not found
1429 private static InetAddress[] getAllByName0(String host,
1437 /* make sure the connection to the host is allowed, before we
1443 security.checkConnect(host, -1);
1459 cache.remove(caddrs.host, caddrs);
1470 addrs = cache.get(host);
1472 addrs = cache.remove(host);
1486 host,
1487 addrs = new NameServiceAddresses(host, reqAddr)
1498 static InetAddress[] getAddressesFromNameService(String host, InetAddress reqAddr)
1505 addresses = nameService.lookupAllHostAddr(host);
1507 if (host.equalsIgnoreCase("localhost")) {
1516 throw ex == null ? new UnknownHostException(host) : ex;
1565 final String host;
1569 CachedLocalHost(String host, InetAddress addr) {
1570 this.host = host;
1578 * Returns the address of the local host. This is achieved by retrieving
1579 * the name of the host from the system, then resolving that name into
1587 * with the local host name and {@code -1}
1592 * @return the address of the local host.
1594 * @exception UnknownHostException if the local host name could not
1608 security.checkConnect(clh.host, -1);
1621 // shortcut for "localhost" host name
1721 String host = (String)gf.get("hostName", null);
1724 InetAddressHolder h = new InetAddressHolder(host, address, family);