3909N/A * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * This class represents an Internet Protocol (IP) address. 0N/A * <p> An IP address is either a 32-bit or 128-bit unsigned number 0N/A * used by IP, a lower-level protocol on which protocols like UDP and 0N/A * TCP are built. The IP address architecture is defined by <a 0N/A * Assigned Numbers</i></a>, <a 0N/A * Address Allocation for Private Internets</i></a>, <a 0N/A * Administratively Scoped IP Multicast</i></a>, and <a 0N/A * Version 6 Addressing Architecture</i></a>. An instance of an 0N/A * InetAddress consists of an IP address and possibly its 0N/A * corresponding host name (depending on whether it is constructed 0N/A * with a host name or whether it has already done reverse host name 0N/A * <h4> Address types </h4> 0N/A * <blockquote><table cellspacing=2 summary="Description of unicast and multicast address types"> 0N/A * <tr><th valign=top><i>unicast</i></th> 0N/A * <td>An identifier for a single interface. A packet sent to 0N/A * a unicast address is delivered to the interface identified by 0N/A * <p> The Unspecified Address -- Also called anylocal or wildcard 0N/A * address. It must never be assigned to any node. It indicates the 0N/A * absence of an address. One example of its use is as the target of 0N/A * bind, which allows a server to accept a client connection on any 0N/A * interface, in case the server host has multiple interfaces. 0N/A * <p> The <i>unspecified</i> address must not be used as 0N/A * the destination address of an IP packet. 0N/A * <p> The <i>Loopback</i> Addresses -- This is the address 0N/A * assigned to the loopback interface. Anything sent to this 0N/A * IP address loops around and becomes IP input on the local 0N/A * host. This address is often used when testing a 0N/A * <tr><th valign=top><i>multicast</i></th> 0N/A * <td>An identifier for a set of interfaces (typically belonging 0N/A * to different nodes). A packet sent to a multicast address is 0N/A * delivered to all interfaces identified by that address.</td></tr> 0N/A * </table></blockquote> 0N/A * <h4> IP address scope </h4> 0N/A * <p> <i>Link-local</i> addresses are designed to be used for addressing 0N/A * on a single link for purposes such as auto-address configuration, 0N/A * neighbor discovery, or when no routers are present. 0N/A * <p> <i>Site-local</i> addresses are designed to be used for addressing 0N/A * inside of a site without the need for a global prefix. 0N/A * <p> <i>Global</i> addresses are unique across the internet. 0N/A * <h4> Textual representation of IP addresses </h4> 0N/A * The textual representation of an IP address is address family specific. 0N/A * For IPv4 address format, please refer to <A 0N/A * address format, please refer to <A 0N/A * System Properties</a> affecting how IPv4 and IPv6 addresses are used.</P> 0N/A * <h4> Host Name Resolution </h4> 0N/A * Host name-to-IP address <i>resolution</i> is accomplished through 0N/A * the use of a combination of local machine configuration information 0N/A * and network naming services such as the Domain Name System (DNS) 0N/A * and Network Information Service(NIS). The particular naming 0N/A * services(s) being used is by default the local machine configured 0N/A * one. For any host name, its corresponding IP address is returned. 0N/A * <p> <i>Reverse name resolution</i> means that for any IP address, 0N/A * the host associated with the IP address is returned. 0N/A * <p> The InetAddress class provides methods to resolve host names to 0N/A * their IP addresses and vice versa. 0N/A * <h4> InetAddress Caching </h4> 0N/A * The InetAddress class has a cache to store successful as well as 0N/A * unsuccessful host name resolutions. 0N/A * <p> By default, when a security manager is installed, in order to 0N/A * protect against DNS spoofing attacks, 0N/A * the result of positive host name resolutions are 0N/A * cached forever. When a security manager is not installed, the default 0N/A * behavior is to cache entries for a finite (implementation dependent) 0N/A * period of time. The result of unsuccessful host 0N/A * name resolution is cached for a very short period of time (10 0N/A * seconds) to improve performance. 0N/A * <p> If the default behavior is not desired, then a Java security property 0N/A * can be set to a different Time-to-live (TTL) value for positive 0N/A * caching. Likewise, a system admin can configure a different 0N/A * negative caching TTL value when needed. 0N/A * <p> Two Java security properties control the TTL values used for 0N/A * positive and negative host name resolution caching: 0N/A * <dt><b>networkaddress.cache.ttl</b></dt> 0N/A * <dd>Indicates the caching policy for successful name lookups from 0N/A * the name service. The value is specified as as integer to indicate 0N/A * the number of seconds to cache the successful lookup. The default 0N/A * setting is to cache for an implementation specific period of time. 0N/A * A value of -1 indicates "cache forever". 0N/A * <dt><b>networkaddress.cache.negative.ttl</b> (default: 10)</dt> 0N/A * <dd>Indicates the caching policy for un-successful name lookups 0N/A * from the name service. The value is specified as as integer to 0N/A * indicate the number of seconds to cache the failure for 0N/A * un-successful lookups. 0N/A * A value of 0 indicates "never cache". 0N/A * A value of -1 indicates "cache forever". 0N/A * @author Chris Warth 0N/A * @see java.net.InetAddress#getByAddress(byte[]) 0N/A * @see java.net.InetAddress#getByAddress(java.lang.String, byte[]) 0N/A * @see java.net.InetAddress#getAllByName(java.lang.String) 0N/A * @see java.net.InetAddress#getByName(java.lang.String) 0N/A * @see java.net.InetAddress#getLocalHost() 0N/A * Specify the address family: Internet Protocol, Version 4 0N/A * Specify the address family: Internet Protocol, Version 6 0N/A /* Specify address family preference */ 5888N/A * Holds a 32-bit IPv4 address. 5888N/A * Specifies the address family type, for instance, '1' for IPv4 5888N/A * addresses, and '2' for IPv6 addresses. 0N/A /* Used to store the name service provider */ 0N/A /* Used to store the best available hostname */ 0N/A /** use serialVersionUID from JDK 1.0.2 for interoperability */ 0N/A * Load net library into runtime, and perform initializations. 0N/A * Constructor for the Socket.accept() method. 0N/A * This creates an empty InetAddress, which is filled in by 0N/A * the accept() method. This InetAddress, however, is not 0N/A * put in the address cache, since it is not created by name. 0N/A * Replaces the de-serialized object with an Inet4Address object. 0N/A * @return the alternate object to the de-serialized object. 0N/A * @throws ObjectStreamException if a new object replacing this 0N/A * object could not be created 0N/A // will replace the deserialized 'this' object 0N/A * Utility routine to check if the InetAddress is an 0N/A * IP multicast address. 0N/A * @return a <code>boolean</code> indicating if the InetAddress is 0N/A * an IP multicast address 0N/A * Utility routine to check if the InetAddress in a wildcard address. 0N/A * @return a <code>boolean</code> indicating if the Inetaddress is 0N/A * a wildcard address. 0N/A * Utility routine to check if the InetAddress is a loopback address. 0N/A * @return a <code>boolean</code> indicating if the InetAddress is 0N/A * a loopback address; or false otherwise. 0N/A * Utility routine to check if the InetAddress is an link local address. 0N/A * @return a <code>boolean</code> indicating if the InetAddress is 0N/A * a link local address; or false if address is not a link local unicast address. 0N/A * Utility routine to check if the InetAddress is a site local address. 0N/A * @return a <code>boolean</code> indicating if the InetAddress is 0N/A * a site local address; or false if address is not a site local unicast address. 0N/A * Utility routine to check if the multicast address has global scope. 0N/A * @return a <code>boolean</code> indicating if the address has 0N/A * is a multicast address of global scope, false if it is not 0N/A * of global scope or it is not a multicast address 0N/A * Utility routine to check if the multicast address has node scope. 0N/A * @return a <code>boolean</code> indicating if the address has 0N/A * is a multicast address of node-local scope, false if it is not 0N/A * of node-local scope or it is not a multicast address 0N/A * Utility routine to check if the multicast address has link scope. 0N/A * @return a <code>boolean</code> indicating if the address has 0N/A * is a multicast address of link-local scope, false if it is not 0N/A * of link-local scope or it is not a multicast address 0N/A * Utility routine to check if the multicast address has site scope. 0N/A * @return a <code>boolean</code> indicating if the address has 0N/A * is a multicast address of site-local scope, false if it is not 0N/A * of site-local scope or it is not a multicast address 0N/A * Utility routine to check if the multicast address has organization scope. 0N/A * @return a <code>boolean</code> indicating if the address has 0N/A * is a multicast address of organization-local scope, 0N/A * false if it is not of organization-local scope 0N/A * or it is not a multicast address 0N/A * Test whether that address is reachable. Best effort is made by the 0N/A * implementation to try to reach the host, but firewalls and server 0N/A * configuration may block requests resulting in a unreachable status 0N/A * while some specific ports may be accessible. 0N/A * A typical implementation will use ICMP ECHO REQUESTs if the 0N/A * privilege can be obtained, otherwise it will try to establish 0N/A * a TCP connection on port 7 (Echo) of the destination host. 0N/A * The timeout value, in milliseconds, indicates the maximum amount of time 0N/A * the try should take. If the operation times out before getting an 0N/A * answer, the host is deemed unreachable. A negative value will result 0N/A * in an IllegalArgumentException being thrown. 0N/A * @param timeout the time, in milliseconds, before the call aborts 0N/A * @return a <code>boolean</code> indicating if the address is reachable. 0N/A * @throws IOException if a network error occurs 0N/A * @throws IllegalArgumentException if <code>timeout</code> is negative. 0N/A * Test whether that address is reachable. Best effort is made by the 0N/A * implementation to try to reach the host, but firewalls and server 0N/A * configuration may block requests resulting in a unreachable status 0N/A * while some specific ports may be accessible. 0N/A * A typical implementation will use ICMP ECHO REQUESTs if the 0N/A * privilege can be obtained, otherwise it will try to establish 0N/A * a TCP connection on port 7 (Echo) of the destination host. 0N/A * The <code>network interface</code> and <code>ttl</code> parameters 0N/A * let the caller specify which network interface the test will go through 0N/A * and the maximum number of hops the packets should go through. 0N/A * A negative value for the <code>ttl</code> will result in an 0N/A * IllegalArgumentException being thrown. 0N/A * The timeout value, in milliseconds, indicates the maximum amount of time 0N/A * the try should take. If the operation times out before getting an 0N/A * answer, the host is deemed unreachable. A negative value will result 0N/A * in an IllegalArgumentException being thrown. 0N/A * @param netif the NetworkInterface through which the 0N/A * test will be done, or null for any interface 0N/A * @param ttl the maximum numbers of hops to try or 0 for the 0N/A * @param timeout the time, in milliseconds, before the call aborts 0N/A * @throws IllegalArgumentException if either <code>timeout</code> 0N/A * or <code>ttl</code> are negative. 0N/A * @return a <code>boolean</code>indicating if the address is reachable. 0N/A * @throws IOException if a network error occurs 0N/A * Gets the host name for this IP address. 0N/A * <p>If this InetAddress was created with a host name, 0N/A * this host name will be remembered and returned; 0N/A * otherwise, a reverse name lookup will be performed 0N/A * and the result will be returned based on the system 0N/A * configured name lookup service. If a lookup of the name service 0N/A * {@link #getCanonicalHostName() getCanonicalHostName}. 0N/A * <p>If there is a security manager, its 0N/A * <code>checkConnect</code> method is first called 0N/A * with the hostname and <code>-1</code> 0N/A * as its arguments to see if the operation is allowed. 0N/A * If the operation is not allowed, it will return 0N/A * the textual representation of the IP address. 0N/A * @return the host name for this IP address, or if the operation 0N/A * is not allowed by the security check, the textual 0N/A * representation of the IP address. 0N/A * @see InetAddress#getCanonicalHostName 0N/A * @see SecurityManager#checkConnect 0N/A * Returns the hostname for this address. 0N/A * If the host is equal to null, then this address refers to any 0N/A * of the local machine's available network addresses. 0N/A * this is package private so SocketPermission can make calls into 0N/A * here without a security check. 0N/A * <p>If there is a security manager, this method first 0N/A * calls its <code>checkConnect</code> method 0N/A * with the hostname and <code>-1</code> 0N/A * as its arguments to see if the calling code is allowed to know 0N/A * the hostname for this IP address, i.e., to connect to the host. 0N/A * If the operation is not allowed, it will return 0N/A * the textual representation of the IP address. 0N/A * @return the host name for this IP address, or if the operation 0N/A * is not allowed by the security check, the textual 0N/A * representation of the IP address. 0N/A * @param check make security check if true 0N/A * @see SecurityManager#checkConnect 0N/A * Gets the fully qualified domain name for this IP address. 0N/A * Best effort method, meaning we may not be able to return 0N/A * the FQDN depending on the underlying system configuration. 0N/A * <p>If there is a security manager, this method first 0N/A * calls its <code>checkConnect</code> method 0N/A * with the hostname and <code>-1</code> 0N/A * as its arguments to see if the calling code is allowed to know 0N/A * the hostname for this IP address, i.e., to connect to the host. 0N/A * If the operation is not allowed, it will return 0N/A * the textual representation of the IP address. 0N/A * @return the fully qualified domain name for this IP address, 0N/A * or if the operation is not allowed by the security check, 0N/A * the textual representation of the IP address. 0N/A * @see SecurityManager#checkConnect 0N/A * Returns the hostname for this address. 0N/A * <p>If there is a security manager, this method first 0N/A * calls its <code>checkConnect</code> method 0N/A * with the hostname and <code>-1</code> 0N/A * as its arguments to see if the calling code is allowed to know 0N/A * the hostname for this IP address, i.e., to connect to the host. 0N/A * If the operation is not allowed, it will return 0N/A * the textual representation of the IP address. 0N/A * @return the host name for this IP address, or if the operation 0N/A * is not allowed by the security check, the textual 0N/A * representation of the IP address. 0N/A * @param check make security check if true 0N/A * @see SecurityManager#checkConnect 0N/A // first lookup the hostname 0N/A /* check to see if calling code is allowed to know 0N/A * the hostname for this IP address, ie, connect to the host 0N/A /* now get all the IP addresses for this hostname, 0N/A * and make sure one of them matches the original IP 0N/A * address. We do this to try and prevent spoofing. 0N/A //XXX: if it looks a spoof just return the address? 0N/A // let next provider resolve the hostname 0N/A * Returns the raw IP address of this <code>InetAddress</code> 0N/A * object. The result is in network byte order: the highest order 0N/A * byte of the address is in <code>getAddress()[0]</code>. 0N/A * @return the raw IP address of this object. 0N/A * Returns the IP address string in textual presentation. 0N/A * @return the raw IP address in a string format. 0N/A * Returns a hashcode for this IP address. 0N/A * @return a hash code value for this IP address. 0N/A * Compares this object against the specified object. 0N/A * The result is <code>true</code> if and only if the argument is 0N/A * not <code>null</code> and it represents the same IP address as 0N/A * Two instances of <code>InetAddress</code> represent the same IP 0N/A * address if the length of the byte arrays returned by 0N/A * <code>getAddress</code> is the same for both, and each of the 0N/A * array components is the same for the byte arrays. 0N/A * @param obj the object to compare against. 0N/A * @return <code>true</code> if the objects are the same; 0N/A * <code>false</code> otherwise. 0N/A * @see java.net.InetAddress#getAddress() 0N/A * Converts this IP address to a <code>String</code>. The 0N/A * string returned is of the form: hostname / literal IP 0N/A * If the host name is unresolved, no reverse name service lookup 0N/A * is performed. The hostname part will be represented by an empty string. 0N/A * @return a string representation of this IP address. 0N/A * Cached addresses - our own litle nis, not! 0N/A * Represents a cache entry 0N/A * A cache that manages entries based on a policy specified 0N/A * Add an entry to the cache. If there's already an 0N/A * entry then for this host then the entry will be 0N/A // purge any expired entries 0N/A // As we iterate in insertion order we can 0N/A // terminate when a non-expired entry is found. 0N/A // create new entry and add it to the cache 0N/A // -- as a HashMap replaces existing entries we 0N/A // don't need to explicitly check if there is 0N/A // already an entry for this host. 0N/A * Query the cache for the specific host. If found then 0N/A * return its CacheEntry, or null if not found. 0N/A // check if entry has expired 0N/A * Initialize cache and insert anyLocalAddress into the 0N/A * unknown array with no expiry. 2801N/A * Cache the given hostname and addresses. 0N/A * Lookup hostname in cache (positive & negative cache). If 2801N/A * found return addresses, null if not found. 0N/A // search both positive & negative caches 0N/A // initialize the default name service 0N/A "Cannot create name service:" 0N/A // get name service if provided and requested 0N/A // if not designate any name services provider, 2801N/A * Creates an InetAddress based on the provided host name and IP address. 0N/A * No name service is checked for the validity of the address. 0N/A * <p> The host name can either be a machine name, such as 0N/A * "<code>java.sun.com</code>", or a textual representation of its IP 0N/A * <p> No validity checking is done on the host name either. 0N/A * <p> If addr specifies an IPv4 address an instance of Inet4Address 0N/A * will be returned; otherwise, an instance of Inet6Address 0N/A * <p> IPv4 address byte array must be 4 bytes long and IPv6 byte array 0N/A * must be 16 bytes long 0N/A * @param host the specified host 0N/A * @param addr the raw IP address in network byte order 0N/A * @return an InetAddress object created from the raw IP address. 0N/A * @exception UnknownHostException if IP address is of illegal length 0N/A * Determines the IP address of a host, given the host's name. 0N/A * <p> The host name can either be a machine name, such as 0N/A * "<code>java.sun.com</code>", or a textual representation of its 0N/A * IP address. If a literal IP address is supplied, only the 0N/A * validity of the address format is checked. 0N/A * <p> For <code>host</code> specified in literal IPv6 address, 0N/A * either the form defined in RFC 2732 or the literal IPv6 address 0N/A * format defined in RFC 2373 is accepted. IPv6 scoped addresses are also 0N/A * <p> If the host is <tt>null</tt> then an <tt>InetAddress</tt> 0N/A * representing an address of the loopback interface is returned. 0N/A * section 2.5.3. </p> 0N/A * @param host the specified host, or <code>null</code>. 0N/A * @return an IP address for the given host name. 0N/A * @exception UnknownHostException if no IP address for the 0N/A * <code>host</code> could be found, or if a scope_id was specified 0N/A * for a global IPv6 address. 0N/A * @exception SecurityException if a security manager exists 0N/A * and its checkConnect method doesn't allow the operation 4273N/A // called from deployment cache manager 0N/A * Given the name of a host, returns an array of its IP addresses, 0N/A * based on the configured name service on the system. 0N/A * <p> The host name can either be a machine name, such as 0N/A * "<code>java.sun.com</code>", or a textual representation of its IP 0N/A * address. If a literal IP address is supplied, only the 0N/A * validity of the address format is checked. 0N/A * <p> For <code>host</code> specified in <i>literal IPv6 address</i>, 0N/A * either the form defined in RFC 2732 or the literal IPv6 address 0N/A * format defined in RFC 2373 is accepted. A literal IPv6 address may 0N/A * also be qualified by appending a scoped zone identifier or scope_id. 0N/A * The syntax and usage of scope_ids is described 0N/A * <p> If the host is <tt>null</tt> then an <tt>InetAddress</tt> 0N/A * representing an address of the loopback interface is returned. 0N/A * section 2.5.3. </p> 0N/A * <p> If there is a security manager and <code>host</code> is not 0N/A * null and <code>host.length() </code> is not equal to zero, the 0N/A * security manager's 0N/A * <code>checkConnect</code> method is called 0N/A * with the hostname and <code>-1</code> 0N/A * as its arguments to see if the operation is allowed. 0N/A * @param host the name of the host, or <code>null</code>. 0N/A * @return an array of all the IP addresses for a given host name. 0N/A * @exception UnknownHostException if no IP address for the 0N/A * <code>host</code> could be found, or if a scope_id was specified 0N/A * for a global IPv6 address. 0N/A * @exception SecurityException if a security manager exists and its 0N/A * <code>checkConnect</code> method doesn't allow the operation. 0N/A * @see SecurityManager#checkConnect 2801N/A // This is supposed to be an IPv6 literal 0N/A // This was supposed to be a IPv6 address, but it's not! 0N/A // if host is an IP address, we won't do further lookup 0N/A // see if it is IPv4 address 0N/A // see if it is IPv6 address 0N/A // Check if a numeric or string zone id is present 0N/A // Means an IPv4 litteral between brackets! 0N/A // We were expecting an IPv6 Litteral, but got something else 0N/A * Returns the loopback address. 0N/A * The InetAddress returned will represent the IPv4 0N/A * loopback address, 127.0.0.1, or the IPv6 loopback 0N/A * address, ::1. The IPv4 loopback address returned 0N/A * is only one of many in the form 127.*.*.* 0N/A * @return the InetAddress loopback instance. 0N/A * check if the literal address string has %nn appended 0N/A * returns -1 if not, or the numeric value otherwise. 0N/A * %nn may also be a string that represents the displayName of 0N/A * a currently available NetworkInterface. 0N/A /* empty per-cent field */ 0N/A * package private so SocketPermission can call it 0N/A /* If it gets here it is presumed to be a hostname */ 0N/A /* Cache.get can return: null, unknownAddress, or InetAddress[] */ 0N/A /* make sure the connection to the host is allowed, before we 0N/A * give out a hostname 0N/A /* If no entry in cache, then do the host lookup */ 0N/A // Check whether the host is in the lookupTable. 0N/A // 1) If the host isn't in the lookupTable when 0N/A // checkLookupTable() is called, checkLookupTable() 0N/A // would add the host in the lookupTable and 0N/A // return null. So we will do the lookup. 0N/A // 2) If the host is in the lookupTable when 0N/A // checkLookupTable() is called, the current thread 0N/A // would be blocked until the host is removed 0N/A // from the lookupTable. Then this thread 0N/A // should try to look up the addressCache. 2801N/A // i) if it found the addresses in the 0N/A // addressCache, checkLookupTable() would 2801N/A // ii) if it didn't find the addresses in the 0N/A // addressCache for any reason, 0N/A // it should add the host in the 0N/A // lookupTable and return null so the 0N/A // following code would do a lookup itself. 3406N/A // This is the first thread which looks up the addresses 3406N/A // this host or the cache entry for this host has been 3406N/A // expired so this thread should do the lookup. 3406N/A * Do not put the call to lookup() inside the 3406N/A * constructor. if you do you will still be 3406N/A * allocating space when the lookup fails. 4273N/A for (
int j =
0; j < i; j++) {
3406N/A // Delete host from the lookupTable and notify 3406N/A // all threads waiting on the lookupTable monitor. 0N/A // If the host isn't in the lookupTable, add it in the 0N/A // lookuptable and return null. The caller should do 0N/A // If the host is in the lookupTable, it means that another 2801N/A // thread is trying to look up the addresses of this host. 0N/A // This thread should wait. 2801N/A // The other thread has finished looking up the addresses of 2801N/A // the host. This thread should retry to get the addresses 2801N/A // from the addressCache. If it doesn't get the addresses from 2801N/A // the cache, it will try to look up the addresses itself. 0N/A * Returns an <code>InetAddress</code> object given the raw IP address . 0N/A * The argument is in network byte order: the highest order 0N/A * byte of the address is in <code>getAddress()[0]</code>. 0N/A * <p> This method doesn't block, i.e. no reverse name service lookup 0N/A * <p> IPv4 address byte array must be 4 bytes long and IPv6 byte array 0N/A * must be 16 bytes long 0N/A * @param addr the raw IP address in network byte order 0N/A * @return an InetAddress object created from the raw IP address. 0N/A * @exception UnknownHostException if IP address is of illegal length 0N/A * Returns the address of the local host. This is achieved by retrieving 0N/A * the name of the host from the system, then resolving that name into 0N/A * an <code>InetAddress</code>. 0N/A * <P>Note: The resolved address may be cached for a short period of time. 0N/A * <p>If there is a security manager, its 0N/A * <code>checkConnect</code> method is called 0N/A * with the local host name and <code>-1</code> 0N/A * as its arguments to see if the operation is allowed. 0N/A * If the operation is not allowed, an InetAddress representing 0N/A * the loopback address is returned. 0N/A * @return the address of the local host. 0N/A * @exception UnknownHostException if the local host name could not 0N/A * be resolved into an address. 0N/A * @see SecurityManager#checkConnect 0N/A * @see java.net.InetAddress#getByName(java.lang.String) 2801N/A // we are calling getAddressesFromNameService directly 0N/A // to avoid getting localHost from cache 2801N/A // Rethrow with a more informative error message. 0N/A * Perform class load-time initializations. 0N/A * Returns the InetAddress representing anyLocalAddress 0N/A * (typically 0.0.0.0 or ::0) 0N/A * Load and instantiate an underlying impl class 0N/A * Property "impl.prefix" will be prepended to the classname 0N/A * of the implementation object we instantiate, to which we 0N/A * delegate the real work (like native methods). This 0N/A * property can vary across implementations of the java. 0N/A * classes. The default is an empty String "". 0N/A "in your properties file.");
0N/A "in your properties file.");
0N/A "in your properties file.");
0N/A throw new Error(
"System property impl.prefix incorrect");
5888N/A /* needed because the serializable fields no longer exist */ 5888N/A * @serialField hostName String 0N/A * Simple factory to create the impl 2801N/A "Inet6AddressImpl" :
"Inet4AddressImpl");