Project 1a - Corral

Client-Server Interfaces, Spring 2004


Table of Contents

Due Date

This assignment is due on Tuesday, 17 February, no later than 5:00 p.m.

See the assignment turn-in page (last modified on 9 February 2004) for instructions on turning in your assignment.

Background

Corral (also known as All the King's Horses) is a simple, two-player game. However, for this half of the project, it doesn't really matter what Corral is.

The Project

This half of the project involves creating a stripped down Corral client and server.

Messages

Each message starts with a one-byte value giving the message tag; the recognized message tags are defined in assignment_base_dir(p1a/corral.h). The structure of the rest of the message depends on the message tag.

  1. The error message - The sender of an error message indicates to the receiver of the error message that the sender has detected an error; the error message, if present, gives a brief description of the error. An error message has the format

    an error message

    where

    1. error - The error message tag.

    2. n - The number of bytes in the message; n may be zero if there's no message.

    3. C1 through Cn - The characters in the message. Each character Ci must be in the range space (ASCII value 32 decimal) to '~' (ASCII value 126 decimal) inclusive. Characters outside this range are invalid.

  2. The play message - A client in search of a game sends a play message to the server. A play message has the format

    a play message

    where

    1. play - The play message tag.
All values are unsigned and in network-byte order.

Client-Server Interaction

The client-server interaction for this part of the project is simple: the client sends a play message to the server and the server responds with an error message, ending the interaction.

Implementation Details

Clients and a server communicate using TCP; if you're really into it, you might try UDP, but I recommend you get a TCP version of the project working before you try UDP.

The client should support the -h and -p command-line options to specify the server's host IP address and listening-port number, respectively. The server should support the -p command-line option to pick specific listening-port number.

Your sever should be always up and always available. If anything bad happens with a particular client, your server should respond with an error message and go on to the next client. Under no circumstances should a client be able to crash your server.

Every connected client, even misbehaving ones, should receive an error message from the server. If a client times out, or takes to long to send a play message, or sends the wrong message, or otherwise misbehavies, it should receive an error message from the server before the server disconnects it.

The choice of implementation language is up to you. However, you should make sure that whatever you chose is available on the cslab machines, which is where I'm going to test your code. It would also be nice, but not required, that your system also run on rockhopper.

Turn-In Details

You should include a makefile among the files you turn in, either for testing or to turn-in. Your makefile should understand three targets: clean, clnt, and srvr. The clean target should delete all dependent files (.o and executables for C++, class files for Java, for example). The clnt target should build the Corral client; the name of the executable should be clnt. The srvr target should build the Corral server; the name of the executable should be srvr.

When you test or turn-in your project, the turn-in script runs (among other things) the following three commands:

$ make clean

$ make clnt

$ make srvr

You should make sure this works correctly.

There's an example makefile you can use in the assignment directory. If anybody feels the need to use ant or some other build mechanism, they should get in touch with me (essentially, what I'll tell you to put it in a makefile, but we'll have to work that out together).

Teams

There are no teams for this half of the project. This half of the project should be implemented individually; each person should submit their own version of the project.

Grading

The grade for this project determines 25% of your grade for the entire first project; the remaining half of the project determines the remaining 75% of your grade (that is, your final grade for Project 1 is the sum of 25% of your grade for the first half plus 75% of your grade for the second half).


This page last modified on 5 February 2004.