Using the PC2v9 API to Start a Contest - pc2ccs/pc2v9 GitHub Wiki

The PC2v9 API supports a variety of contest operations. Among these are that the API can be used to perform PC2 Admin functions such as starting or stopping a contest.

The ServerConnection class main() method connects to a running PC2v9 Server. ServerConnection accepts various arguments which it uses to instruct the Server to perform Administrative operations such as starting or stopping the contest clock.

Examples

The following command can be used to connect to a running Server and instruct it to start a contest using the adminstrator 2 account with a joe password (a "joe" password is a password that is the same as the account name).

ServerConnection --login a2

Note that the default action associated with a ServerConnection login is "start the contest clock"; the argument --start can also be used.

The following command uses the ServerConnection class to login (using a "joe" password) and stop the contest clock:

ServerConnection --login a2 --stop

The following command logs into to the Server using the administrator1 account, with an explicit password "pass" and starts the contest clock:

ServerConnection --login administator1 --password pass

Sample DOS script

 set CLASS=edu.csus.ecs.pc2.api.ServerConnection
 set libdir=lib
 if %@@ == @@ set LOGIN=--login a2
 java -Xms64M -Xmx768M -cp "%libdir%\*" %CLASS% %LOGIN% %1 %2 %3 %4 %5 %6 %7 %8 %9

Sample Unix command

 java -cp "lib/*" edu.csus.ecs.pc2.api.ServerConnection --login r

ServerConnection Usage

The following shows the default "usage" output of the ServerConnection class:

 Usage: ServerConnection [--help] --login LOGIN [--passowrd PASS] [--stop]
 Purpose to start (default) pc2 server contest clock, or stop contest clock

See Also

⚠️ **GitHub.com Fallback** ⚠️