Solved

host name look up on ip address

Posted on 2014-01-31
1
404 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
1 Comment
 
LVL 12

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
strCount chalenge 3 50
mapBully challenge 6 89
Eclipse Neon and jdk 1.8.0 11 72
solarwind tftp server 2 32
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

760 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now