Win a copy of Head First Android this week in the Android 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Problem with client and server screens

Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm currently using the observable and observer class/interfaces(s) to update network client server information. I have since decided against this and just wish to use a frame for the server and another one for standalone client/network client as I have found it very difficult to select correct coding events in the screens to use observer/observable pattern. I'm hoping to say do all my validation at the "start server" on server screen and "connect" buttons on client screens. Could someone give an idea of the following:
(1) How can I identify the server address (ip address) that the server runs on when running the server in order to write to the common properties file?
(2) How does the network client know the ip address and port the server is running on to know that the database location and port fields entered in the network client window are right? 1 way I think of doing this is to synchronize on the shared properties file and if server address and port number don't exist, 1 cannot start the client. In other words how does client know server is running?
Thanks very much.
Posts: 11604
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mark,

(1) as a default I used "localhost" to write to the (if it doesn't exist yet)
(2) synchronizing on the properties file is a bit hard if the server runs on computer 1 and the client on another computer in the network. how would you do that? just keep it simple: i show a dialog to enter the ip address and port number when networked client is started. If provided information is valid (= able to connect to the server) the main window of the application shows (else an error message is shown and client shuts down).

Hope it helps!
Kind regards,
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic