Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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

 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic