Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

What is the 'host" in the .getByName() method?  RSS feed

 
Karen Baog
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I am writing a test Client application.
On the Class InetAddress, the getByName(String host) method requires a "host" parameter.
Does the "host" parameter refer to the name of the remote machine on the LAN network the Server application is running, or is it the local machine (where the Client application is running)?

LocalMachine<------>RemoteMachine
Client.java Server.java

The Client.java has the code:
String machineName = "somecomputername";
address = InetAddress.getByName(machineName);

Will the machineName reflect the machine name where the Client.java program is running, or is it the name of the remote machine the Server.java is running?


Karen
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I recall correctly, the host is the machine where the server side of the application is running. This is most likely a remote machine, but not necessarily, especially if you are testing both the server and client on the same machine.

Layne

p.s. If you have further questions about network programming in Java, you should mosey over to our Sockets and Internet Protocols forum which is dedicated to this portion of the Java API.
[ July 13, 2005: Message edited by: Layne Lund ]
 
Karen Baog
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Layne.

The Socket forum has very little traffic. I notices that a lot offorum members who post questions and, in most cases, help others in the beginner's forum, are certified.
Also, my questions on networking are pretty much basic, I guess.
Anyway, thanks again.
 
Marilyn de Queiroz
Sheriff
Posts: 9080
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think network stuff is beyond basic Java. Basic network stuff might be intermediate. Most of us view more than one forum. If everyone on JavaRanch posted in Java in General, we'd have 3 humongous forums and a new question would scroll off the page before anyone had a chance to see it. This is the main reason we had to split Servlets from JSPs. The original "Servlets and JSP" forum got too big and busy.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!