• Post Reply Bookmark Topic Watch Topic
  • New Topic

socket I/O & getLocalHost()  RSS feed

 
karl nilsson
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was working on a networking application, and for testing purposes, the client's socket was always opened up with the getLocalHost() method

How would I change this code when the application is ready to be run on two or more separate computers?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The client will have to know the server address one way or another. There are a lot of choices ... from the command line, from a Java property, from configuration, from a JNDI lookup, and so on. Do any of those sound interesting? Or particularly wrong your environment and application?
 
karl nilsson
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, I haven't heard of a JNDI lookup, so I would like to know more about that, but I believe that the command line or configuration method would be the best.
would the command line solution look like this:


and how would the configuration solution work?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!