InetAddress question

Discussion in 'Java' started by Rhino, Feb 26, 2005.

  1. Rhino

    Rhino Guest

    I am dabbling with the InetAddress class. Can anyone tell me why/when the
    getAllByName() method in that class would ever return more than one value?

    I'm trying to figure out if using getByName() will be sufficient for all but
    the most obscure situations or whether it is safer to use getAllByName()
    every time.

    --
    Rhino
    ---
    rhino1 AT sympatico DOT ca
    "There are two ways of constructing a software design. One way is to make it
    so simple that there are obviously no deficiencies. And the other way is to
    make it so complicated that there are no obvious deficiencies." - C.A.R.
    Hoare
    Rhino, Feb 26, 2005
    #1
    1. Advertising

  2. Rhino

    Tilman Bohn Guest

    In message <vT0Ud.60387$>,
    Rhino wrote on Sat, 26 Feb 2005 10:49:06 -0500:

    > I am dabbling with the InetAddress class. Can anyone tell me why/when the
    > getAllByName() method in that class would ever return more than one value?


    When there is more than one IP address, or more precisely, more than
    one A record for that hostname -- so-called multi-homed hosts. For
    example, do an nslookup www.yahoo.com. (Actually, in this case there is
    only a CNAME record aliasing www.yahoo.com to www.yahoo.akadns.net, and
    then there are half a dozen A records for that name. But you can ignore
    that additional level of indirection for this discussion, as it's
    handled transparently for you by your resolver, and consequently by
    the InetAddress class.)

    > I'm trying to figure out if using getByName() will be sufficient for all but
    > the most obscure situations or whether it is safer to use getAllByName()
    > every time.


    It depends on what you need to do and how resilient you want or need
    to be against failures.

    --
    Cheers, Tilman

    `Boy, life takes a long time to live...' -- Steven Wright
    Tilman Bohn, Feb 26, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. C
    Replies:
    1
    Views:
    825
  2. vertigo

    IP: long-> InetAddress

    vertigo, May 2, 2004, in forum: Java
    Replies:
    2
    Views:
    4,412
    Roedy Green
    May 3, 2004
  3. Madhur Ahuja
    Replies:
    1
    Views:
    723
    Paul Lutus
    Aug 29, 2004
  4. Linus

    InetAddress

    Linus, Jan 28, 2005, in forum: Java
    Replies:
    5
    Views:
    12,834
    Linus
    Jan 31, 2005
  5. Replies:
    0
    Views:
    4,599
Loading...

Share This Page