CSE 3214 : Programming Assignment 1
This assignment is due 10 am, Feb 18, 2014. It should be submitted using the
submit command (see the instructions below).
Objective:
The objective of this lab. is to get familiar with TCP/IP and its UNIX
interface, and then build the skeleton of a very simple distributed gaming
system. The system should allow you to log on to a server and play a game
with other people logged on to the same server.
There are two parts to the application you will write: one part that implements
the directory server and a second part that implements online gaming between
peers. Note that the first part is a pure client server architecture and the
second is a peer-to-peer application.
For the first part, you should write a client/server application that does the
following.
-
The concurrent server program runs waiting for a connection from a
client.
- The clients and the server should (in general) run on different machines.
-
Each client can send three different messages -- JOIN, LEAVE and LIST. The first two are for joining and leaving the list of players who are online and are
willing to play. The last is to retrieve the list of online players. The
server responds to these messages with the appropriate actions. Note that the
server needs to be concurrent because multiple clients should be able to talk
to it simultaneously. Note also that changes to the list of online players
maintained by the server must be serialized to keep the list consistent.
-
The second part is (in essence) a simple P2P application. Your program should
display to the user the list of online players and allow him/her to choose a
potential opponent to play with. Then your program sends a INVITE message.
The opponent may be offline or simply refuse to play (perhaps because the
player is already in a game). If the opponent replies with a positive reply
then your program should launch a game. I suggest Tic-Tac-Toe because of its
simplicity but you are free to choose a more complex game. Note that there are
some subtle issues here -- each player is a server and a client. In fact it is
better to run multiple sockets -- one dedicated to listening to peer communication and other(s) for the game data exchange. Since human players are playing the
game your program needs only to update the game configuration and not implement
strategy etc.
-
This is meant to be a skeletal program, and you probably will need to impose
some limitations; that is fine, just state them clearly.
- You will lose points if your program does not close the sockets
when the program quits.
-
In order to prevent two students from using the same socket number on the
same machine, you should use the socket number that is 20000 + x, where x is
the last 4 digits of your student number.
-
You may use C/C++ or Java. Resources for network programming in either
language are on the class page.
-
Check the class page for clarifications etc.
-
You can download the basic client server code in the language of your choice from any site, but please cite that source in your report and code. Not doing so is a breach of academic honesty.
Compiling the server and client
programs (C language only)
-
Compile the programs with gcc instead of cc.
-
For the server program, you need the -lsocket flag
-
For the client program, you need the flags -lsocket -lnsl
Instructions for submitting
assignment 1
Submit the programs using the following command:
- submit 3214 a1 <filename>.
- Read the manpages ("man submit") for more details on the submit command.
- It may not be possible to submit the files after the deadline.
-
The programs you submit should work and be documented.
-
Your assignment should include a separate (typed) document containing the
results (You can hand this in the class). This document should contains details
of
-
the overall program design, a textual description of "how it works", and
design decisions made.
-
possible improvements and extensions to your program that you would do if you
had more time.
-
situations (if any) when your program may not work correctly.
-
how the grader can compile and run your program.
Grading
Program works correctly : 50%
quality of code and in-line documentation : 25%
report : 25%
NOTE: Late submissions get no credit.
Copying, teamwork
Copying of programs (also written homeworks and exams) or teamwork on
an assignment (written or programming) is not permitted. No form
of copying is tolerated in this (or any) course, in accordance with
departmental policy.