• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about the run mode

 
Jofer Chan
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,everyone:
in my assignment, must use java -jar <path_and_filename> [<mode>]
to run the program,my question is follow:
1. How to implement that just modify mode to change the client,server and single mode?
2. Does need to write a main program use the "switch" statment to implement that?
3. Does the client and server both to access the same Prop file?
 
Bill Robertson
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. How to implement that just modify mode to change the client,server and single mode?
You have one launch program that takes an argument that determines whether
or not to launch the server, the client to connect to the server, or to
just run in standalone mode. In my directions the mode flag is "The mode flag must be either "server", indicating the server program must run, "alone", indicating standalone mode, or left out entirely, in which case the network client and gui must run."
2. Does need to write a main program use the "switch" statment to implement that?
Your main program could do it this way or an "if". Or I am sure there are
other creative but probably unnecessary ways people have come up with.
3. Does the client and server both to access the same Prop file?
Not likely. Think about it, they will be running on two seperate machines
theoretically. And you of course you don't want each client to have the ability to change your server settings prop file.
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think anybody is coding functionality to allow the user to switch between modes at runtime.
As for your question 2, I'll let you mull that over.
For question 3, I think it depends on which assignment you have. I have URLyBird 1.2.2 or something like that -- it only gives one file that properties have to be saved in. So, yes, there may be many installations of the program on different machines (server, clients ... ), but they all load the properties from the same file name.
It's all pretty clear in my specs. I assume it would say something very specific in yours. If it doesn't, just use your best judgement.
 
Terry Martinson
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In mine I am using one property file name to be used for all properties. When doing this type of thing, just be sure to name the properties clearly so that you know for sure where they apply - client.database, server.database, server.port, etc.
TJ
 
Jofer Chan
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,Bill ,Nathaniel and Terry:
thank you,
your ideas help me to implement that.
thank you!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic