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.
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:
Originally Posted by Horcrux7
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.