classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Texual IPv6 address


From: Mattias Rehnberg
Subject: Texual IPv6 address
Date: Sun, 14 Nov 2004 19:03:10 +0100

Hello,

The java.net.Inet6Address class seems to produce invalid textual 
representations in some cases. In the example below, the output is 
IPv6:1010:::::2020::1 instead of IPv6:1010:0:0:0:0:2020:0:1 (or 1010::2020:0:1) 
that one would expect. I've included a patch that deactivates the suppression 
of zero segments.

byte[] adr = { 0x10, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x00, 0x20, 0x20, 
0x0, 0x0, 0x0, 0x1 };

System.out.println("IPv6:" + InetAddress.getByAddress(adr).getHostAddress());

/Mattias




Attachment: Inet6Address.diff
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]