Results 1 to 3 of 3
  1. #1
    DWASH5000 is offline Member
    Join Date
    Oct 2010
    Location
    New York
    Posts
    2
    Rep Power
    0

    Default DNS look up question

    I'm using InetAdress.getByName(String host) using a literal string representing a IPV6 address. My question is does this result in a DNS query vs using a host name like "www.abc.com". The api documentaion says when you use the literal string it just checks to see if the address is valid. I always thought getHostByName() doesn the DNS query. Just want to hear about people's experience with this. Any information will be helpful thanks.

  2. #2
    Horcrux7 is offline Member
    Join Date
    Sep 2010
    Posts
    33
    Rep Power
    0

    Default

    A literal string representation is not IPv4 or IPv6. It is literal. "www.java-forums.org" for example is a literal host name. If you want solve a numeric IPv6 address then you need it quote in parenthesis like [:1]. If you use a IPv6 address it will take a DNS request.
    Volker Berlin
    www.inetsoftware.de

  3. #3
    DWASH5000 is offline Member
    Join Date
    Oct 2010
    Location
    New York
    Posts
    2
    Rep Power
    0

    Default

    Quote Originally Posted by Horcrux7 View Post
    A literal string representation is not IPv4 or IPv6. It is literal. "www.java-forums.org" for example is a literal host name. If you want solve a numeric IPv6 address then you need it quote in parenthesis like [:1]. If you use a IPv6 address it will take a DNS request.
    Thanks for the response researching more I found this:

    When you call getByName( ) with an IP address string as an argument, it creates an InetAddress object for the requested IP address without checking with DNS. This means it's possible to create InetAddress objects for hosts that don't really exist and that you can't connect to. The hostname of an InetAddress object created from a string containing an IP address is initially set to that string. A DNS lookup for the actual hostname is performed only when the hostname is requested, either explicitly via getHostName( ) or implicitly through toString( ). So I'm basically doing what you mentioned.

Similar Threads

  1. Question mark colon operator question
    By orchid in forum Advanced Java
    Replies: 9
    Last Post: 12-19-2010, 09:49 AM
  2. Question about ++x and x++
    By makeawish in forum New To Java
    Replies: 2
    Last Post: 10-18-2010, 11:50 AM
  3. Question
    By vittoire in forum New To Java
    Replies: 3
    Last Post: 02-02-2010, 01:54 PM
  4. Hello everyone and my first question
    By htetnaing in forum New To Java
    Replies: 3
    Last Post: 01-26-2009, 04:49 PM
  5. question about rmi
    By leonard in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 05:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •