Solved

host name look up on ip address

Posted on 2014-01-31
1
410 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Python Assistance 7 73
Checkbox and ListView in Android Layout 4 56
ArrayIndexOutOfBoundException 9 67
custom annotations 9 31
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

910 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

21 Experts available now in Live!

Get 1:1 Help Now