Solved

host name look up on ip address

Posted on 2014-01-31
1
486 Views
Last Modified: 2014-02-03
Hi,

I am trying below example.
http://www.avajava.com/tutorials/lessons/how-do-i-use-a-host-name-to-look-up-an-ip-address.html

I wonder why got out put 5 different times as below

--------------------------
Which Host:local host
Canonical Host Name:DERBIZZ
Host Name:DERBIZZ
Host Address:192.168.1.106
----------------------------------------------------
Which Host:www.google.com
Canonical Host Name:po-in-f104.google.com
Host Name:www.google.com
Host Address:72.14.253.104
----------------------------------------------------
Which Host:www.google.com #1
Canonical Host Name:po-in-f104.google.com
Host Name:www.google.com
Host Address:72.14.253.104
--------------------------
Which Host:www.google.com #2
Canonical Host Name:po-in-f103.google.com
Host Name:www.google.com
Host Address:72.14.253.103
--------------------------
Which Host:www.google.com #3
Canonical Host Name:po-in-f99.google.com
Host Name:www.google.com
Host Address:72.14.253.99
--------------------------
Which Host:www.google.com #4
Canonical Host Name:po-in-f147.google.com
Host Name:www.google.com
Host Address:72.14.253.147


what is difference between cononical host name and host name.
Just as an aside, what happens if we try doing a lookup on a host that doesn't exist, such as: InetAddress.getByName("www.this-host-does-not-exist.com")? An UnknownHostException is thrown, as shown below.

java.net.UnknownHostException: www.this-host-does-not-exist.com: www.this-host-does-not-exist.com


what is the meaning of host not exists.

please advise
Any links resources ideas highly appreciated. Thanks in advance
0
Comment
Question by:gudii9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
Phil Phillips earned 500 total points
ID: 39825391
You got different a list of results because Google has it set up so that www.google.com resolves to a whole set of IPs.  This helps Google distribute their load.

In this case, the canonical hostname is the "true" hostname of each particular IP, while the hostname is the original hostname you used for your query.

As for the "host not exists", that's just an example of what happens when you query a hostname that does not resolve.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This video teaches viewers about errors in exception handling.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question