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.
(1) as a default I used "localhost" to write to the suncertify.properties (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).