Results 1 to 3 of 3
Thread: DNS look up question
- 10-26-2010, 02:46 PM #1
Member
- Join Date
- Oct 2010
- Location
- New York
- Posts
- 2
- Rep Power
- 0
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.
- 10-26-2010, 10:37 PM #2
Member
- Join Date
- Sep 2010
- Posts
- 33
- Rep Power
- 0
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
- 10-27-2010, 02:22 AM #3
Member
- Join Date
- Oct 2010
- Location
- New York
- Posts
- 2
- Rep Power
- 0
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
-
Question mark colon operator question
By orchid in forum Advanced JavaReplies: 9Last Post: 12-19-2010, 08:49 AM -
Question about ++x and x++
By makeawish in forum New To JavaReplies: 2Last Post: 10-18-2010, 10:50 AM -
Question
By vittoire in forum New To JavaReplies: 3Last Post: 02-02-2010, 12:54 PM -
Hello everyone and my first question
By htetnaing in forum New To JavaReplies: 3Last Post: 01-26-2009, 03:49 PM -
question about rmi
By leonard in forum New To JavaReplies: 1Last Post: 08-06-2007, 04:19 AM


LinkBack URL
About LinkBacks


Bookmarks