InetAddress.java (getCanonicalHostName): Support IPv6 addresses.
2004-11-17 Michael Koch <konqueror@gmx.de> * java/net/InetAddress.java (getCanonicalHostName): Support IPv6 addresses. From-SVN: r90793
This commit is contained in:
committed by
Michael Koch
parent
7c8347536f
commit
879245b6b2
@@ -322,8 +322,14 @@ public class InetAddress implements Serializable
|
||||
}
|
||||
|
||||
// Try to find the FDQN now
|
||||
// FIXME: This does not work with IPv6.
|
||||
InetAddress address = new Inet4Address(getAddress(), null);
|
||||
InetAddress address;
|
||||
byte[] ipaddr = getAddress();
|
||||
|
||||
if (ipaddr.length == 16)
|
||||
address = new Inet6Address(getAddress(), null);
|
||||
else
|
||||
address = new Inet4Address(getAddress(), null);
|
||||
|
||||
return address.getHostName();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user