Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4404831

java.net.Inet6Address.getHostAddress() is incomplete

XMLWordPrintable

    • beta2
    • sparc
    • solaris_2.6



      Name: dfR10049 Date: 01/16/2001



      java.net.Inet6Address.getHostAddress() states:

        "Returns the IP address string in standard text presentation form"

      But there is no specification for "standard text presentation form"

      rfc2373(IP Version 6 Addressing Architecture) allows to use 4 forms of
      text presentation of IPV6 addresses.
      For example, the next four strings are equivalent presentation of the same address:

      1080:0:0:0:0:800:200C:417A
      1080::800:200C:417A
      1080:0:0:0:0:800:32.13.65.122
      1080::800:32.13.65.122

      No one of these forms is called "standard form". So javadoc should specify
      the format or several formats can be used for the IPV6 addresses representation.

      Please find a part of rfc2373 below:

      2.2 Text Representation of Addresses

         There are three conventional forms for representing IPv6 addresses as
         text strings:

         1. The preferred form is x:x:x:x:x:x:x:x, where the 'x's are the
            hexadecimal values of the eight 16-bit pieces of the address.
            Examples:

               FEDC:BA98:7654:3210:FEDC:BA98:7654:3210

               1080:0:0:0:8:800:200C:417A

            Note that it is not necessary to write the leading zeros in an
            individual field, but there must be at least one numeral in every
            field (except for the case described in 2.).

         2. Due to some methods of allocating certain styles of IPv6
            addresses, it will be common for addresses to contain long strings
            of zero bits. In order to make writing addresses containing zero
            bits easier a special syntax is available to compress the zeros.
            The use of "::" indicates multiple groups of 16-bits of zeros.
            The "::" can only appear once in an address. The "::" can also be
            used to compress the leading and/or trailing zeros in an address.

            For example the following addresses:

               1080:0:0:0:8:800:200C:417A a unicast address
               FF01:0:0:0:0:0:0:101 a multicast address
               0:0:0:0:0:0:0:1 the loopback address
               0:0:0:0:0:0:0:0 the unspecified addresses

            may be represented as:

               1080::8:800:200C:417A a unicast address
               FF01::101 a multicast address
               ::1 the loopback address
               :: the unspecified addresses

         3. An alternative form that is sometimes more convenient when dealing
            with a mixed environment of IPv4 and IPv6 nodes is
            x:x:x:x:x:x:d.d.d.d, where the 'x's are the hexadecimal values of
            the six high-order 16-bit pieces of the address, and the 'd's are
            the decimal values of the four low-order 8-bit pieces of the
            address (standard IPv4 representation). Examples:

               0:0:0:0:0:0:13.1.68.3

               0:0:0:0:0:FFFF:129.144.52.38

            or in compressed form:

               ::13.1.68.3

               ::FFFF:129.144.52.38


      ======================================================================

            ywangsunw Yingxian Wang (Inactive)
            fdasunw Fda Fda (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: