Hi guys, If user doesn't provide mode, server and GUI client should run, right? But, how do I run the server and then run the GUI client? I use socket, after socket server started it goes into a loop until timeout or user press CTRL-C key. This way, GUI client will never be able to execute while server is running. How do you guys handle this mode? Thanks, Nitti
Hopefully I got this straight. If the user does not provide any mode, then youare to assume local mode? In local mode there is only the client, there is no server running. That really is the assignment point of the two modes. Can you design a system that in remote mode uses a server on a machinet, and in local mode the client runs by itself with its local db.db file. Mark
Hi Mark, If user use "alone" as the parameter, it's local mode with local database file access. If user use "server", the server program has to run. If user leave it blank, the server and a network GUI client has to run. My question is, if user leaves it blank, do I need to start the server and then run a GUI client, which will use socket connection (localhost) to access database file. I also remember the instruction says something like "server and client has to be able to run on the same JVM... I think I'm totally lost. Could anyone help me out? Thanks, Nitti
But, how do I run the server and then run the GUI client? You don't. Not as part of the same JVM instance. Once you invoke java -jar <path> server you've started a server, period. It's not expected to be used by any local GUI; it just handles clients over the network. If you want to start up a GUI attached to that server, then open a new command shell window, and type java -jar <path> to start a new (networked) client, and have it connect to the server. You can't directly attach a GUI to the server once it's started in network mode - you have to go through the network. Alternately, you can start it in local mode java -jar <path> alone and in this case once it's started this process will be local-only; it will have a GUI but you can't tell it to start networking later. That really is the assignment point of the two modes. I think we're interpreting the question differently. We need to design the components so that they can interact in either mode. However given the command options we are instructed to implement, there's no need (or possibility, IMO) to be able to switch from one mode to the other once a process has been started. The code must be flexible; a process running the code need not be, once it's started. Ummm, I think.
I also remember the instruction says something like "server and client has to be able to run on the same JVM... The server (the Data class and attached classes) and the GUI client need to be able to run in the same JVM if the user has invoked "alone" mode. But no networked clients will be supported in this case - the section on "Non-Networked Mode" specifies that the progam must perform no networking when in standalone mode. So the "server" is just serving one client here, the local GUI.
Thanks a lot! So, before examiner executes java -jar runme.jar, he will execute java -jar runme.jar server Is that right? Thanks, Nitti [ June 03, 2003: Message edited by: Nitti Lin ]
So, before examiner executes java -jar runme.jar, he will execute java -jar runme.jar server Right. Well, possibly the examiner might start the client first to see how it deals with the fact that there's no server - some sort of error message, perhaps. But the main expected sequence is (a) start server (b) start client.
If user leave it blank, the server and a network GUI client has to run. [Nitti] Please check the above. I remember, If user leaves blank, network client, and GUI must run. Not the server. That means, some where server is running. So we need to connect the server by providing database location. So we need to provide a dialog to collect the database location, defaults to //localhost. If server is not running at the location provided (non local mode), we must popup a message saying, server is not found at that location. Am I right techies? Regards, Ganapathy.
I remember, If user leaves blank, network client, and GUI must run. Not the server. You are correct - at least, that's what my instructions say too. I didn't look closely enough at what Nitti said here. I agree with your description, Ganapathy.
To sum up, if user didn't set any mode, a GUI client will run and a server client will try to access the server and program needs to handle if server is not running. Is that right? Thanks, Nitti