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

getByName returns a different result from the one for getLocalHost

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1.3
    • core-libs
    • None
    • sparc
    • solaris_2.5.1



      Name: rlT66838 Date: 07/17/97


      1. To get InetAddress object for local host, I wrote the source code like the following.

            InetAddress thishost = InetAddress.getByName(null);

         In this case, getByName returns the followings.

            localhost/127.0.0.1

      2. As the other way, I wrote the following code to get InetAddress object for local host.

            InetAddress thishost = InetAddress.getLocalHost();

         In this case, getLocalHost returns the followings on my environment.

            icarus/XXX.XXX.XXX.XXX
            (In fact, XXX.XXX.XXX.XXX is correct IP address.)

         icarus is the host name for the machine executing that program.
         So, I think getByName returns wrong result.



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

            brenaudsunw Benjamin Renaud (Inactive)
            rlewis Roger Lewis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: