This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes HELP - Socket and Hostname? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "HELP - Socket and Hostname?" Watch "HELP - Socket and Hostname?" New topic

HELP - Socket and Hostname?

lydia westland
Ranch Hand

Joined: Feb 24, 2002
Posts: 72
Hi all,
I used the InetAddress.getHostName() to get a computer's name. and the InetAddress.getIP(). The InetAddress is generated when the socket connection is established. But a werid thing is, sometimes this works well. sometimes the hostname is the IP( not the computer name). and sometimes the hostname can become some words got from the Hosts file. How can I do to make them consistent?
thank you.

Lydia<br />~~~~~~~~~~~~<br />I love Italy team.
I agree. Here's the link:
subject: HELP - Socket and Hostname?
Similar Threads
hostname from ip address
HELP - socket and host name?
how to give port number for socket class
IP Address as a hostname string !
reading and writing socket problem