I searched a bit here before asking this question.
InetAddress.getByName("SOMECONSTANTCOMPUTERNAME.xxx.CORP.xxx.COM").isReachable(10000)
This always returns false or UnknownHostException but by using cmd and writing
ping SOMECONSTANTCOMPUTERNAME.xxx.CORP.xxx.COM
I am getting ping status.
Finally apologies if I didn't do proper research.
Regards, icr
You may be trying to get the IP address of an IPv6 address and a scope_id was specified for a global IPv6 address. As the API throws UnknownHostException only in two scenarios as mentioned here:
getByName
public static InetAddress getByName(String host) throws UnknownHostException Determines the IP address of a host, given the host's name. The host name can either be a machine name, such as "java.sun.com", or a textual representation of its IP address. If a literal IP address is supplied, only the validity of the address format is checked.
For host specified in literal IPv6 address, either the form defined in RFC 2732 or the literal IPv6 address format defined in RFC 2373 is accepted. IPv6 scoped addresses are also supported. See here for a description of IPv6 scoped addresses.
If the host is null then an InetAddress representing an address of the loopback interface is returned. See RFC 3330 section 2 and RFC 2373 section 2.5.3.
Parameters: host - the specified host, or null.
Returns: an IP address for the given host name.
Throws: UnknownHostException - if no IP address for the host could be found, or if a scope_id was specified for a global IPv6 address.
Learn more about IPv6 scoped address here:
http://docs.oracle.com/javase/6/docs/api/java/net/Inet6Address.html#scoped
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With