aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Problem with client and server screens Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Problem with client and server screens " Watch "Problem with client and server screens " New topic
Author

Problem with client and server screens

Mark O' Sullivan
Ranch Hand

Joined: Aug 17, 2009
Posts: 160
Hi,
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.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5215
    
  12

Hi Mark,

(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).

Hope it helps!
Kind regards,
Roel

SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with client and server screens