CMSC 22001: Software Construction Assignment 7: Networking
|Due: Mar 25, 2008 @ noon|
Adapt the administrator so that remote sites can register players.
Adapt the players so that they can register and play with a remote Scrabble server.
Adapt the administrator to play matches between players, or even a tournament between multiple players.
In this assignment, you must adapt your server and players so they can be run over the network. This should be done by making a proxy player for use in the server and a proxy turn object for use on the client. The proxy player will behave like any other player, as far as the server is concerned, but its strategy will be to consult the network to find out what to do. The proxy turn object will look just like the ordinary turn object, from the point of view of the player, but it will communicate the move back over the network when the player invokes its methods.
In general, each method call will correspond to a pair of messages on the network, one for the method call and one for the method return.
To begin the communication, the client establishes a TCP/IP connection to the server and then sends a registerPlayer message to the server, to which the server replies with a void message (see below for the precise content of all of the messages).
After that initial sequence of messages, the communication follows this state machine:
Note that these are slightly different than the contracts specified on the interfaces in assignment 5 (they are generalized to handle tournaments). Adjust the contracts in your code accordingly.
These are the precise specification of the messages on the edges in the above diagram (see the data page for the definitions of the non-terminals and whitespace conventions):
Hints First, develop the programs that can translate method calls into text messages and text messages into method calls (test the parsing!). Second, wire in your existing code and test each half independently by simulating messages from the other half for simple interactions. Finally, wire everything together and play some games.
For now, test your new system on a local machine. Use port 9000 to communicate via TCP/IP.
|CMSC 22001: Software Construction|