Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

host name look up on ip address

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
ASKER CERTIFIED SOLUTION
Avatar of Phil Phillips
Phil Phillips
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial