• Post Reply Bookmark Topic Watch Topic
  • New Topic

HELP - socket and host name?

 
lydia westland
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
maateen ashraf
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
would u like to send code here on forum so that i can check it on my machine
but the thing is that u must know the name or ip addresso of the machine to whom u want to get connected through socket..
but here u say that after getting connected u ask for name or ip where as u ought to know it before getting connected..
anyhow send code..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!