The goal of this assignment is to learn how to write two programs in C that communicate with each other via stream sockets using TCP.
This assignment is worth 10 points. Distribution of points is indicated below.
We are working toward building a game that will consist of two parts:
a server that will run locally on a CS machine and
a client that will run on the machine belonging to the person(s)
playing your game.
In this assignment, you will take the C program you wrote for hw#2 and
divide it into two programs -- one which will be the server and the other
which will act like the client.
(Note: your client will be replaced with a Java application in hw#4 and a Java applet in hw#5).
You need to decide which components of hw#2 belong in the server and which belong in the client:
You will need to define a little language for your client and server to communicate with each other. You need to think about what kinds of information will be sent back and forth. For this assignment, you only need to communicate login information. In later assignments, the client and server will need to communicate about elements of the game. Here are five commands to start your language:
FIRST: print out the timesheet and keep track of how much time you spend doing the tasks outlined below.
1. design.(2 points)
As usual, you need to begin with a design document.
For this assignment, you design document must describe the flow of data between the data files, the user, the client and the server.
A picture is worth a thousand words (and 1 point).
You need to include in this description not only information on the data flow for the login procedure, detailed above, but also the information on the data flow for the game (which you will implement in a later assignment). So your description here should include the other commands you anticipate needing for your client-server language (1 point).
If you make any changes to the game as described in your first homework, you must document these changes here.
This documentation should be 1-2 pages, 10-point font. It must be complete -- so you need to be CLEAR and CONCISE. You MUST print out the documentation and bring it to class on the due date.
2. build the server.
Start with my server.c sample program and your hw#2. Extract the functions from your hw#2 that interact with the data files. You should make use of the header file you created for hw#2.
The server should do the following:
hw3server<your-cs-username>.c, so for example, mine is called
3. build the client.
Start with my client.c sample program and your hw#2. Extract the functions from your hw#2 that interact with the user.
The client should do the following:
hw3client<your-cs-username>.c, so for example, mine is called
You need to submit your program in two ways: electronically and hard copy.
Follow the submission instructions.
(1) Print out the homework template cover page and fill it out.
(2) Print out the timesheet and fill it out.
(3) STAPLE the cover page, timesheet and hardcopy of your documentation together.
(4) Make sure your name and CS username are on all the papers you hand in!
(5) Bring all this to class on the day the assignment is due and deposit it in the homework box at the front of the classroom within the first 5 minutes of the class (by 1.15pm).