EECS 3214 : Programming Assignment 1
Submit only part 2 of this assignment using the submit command (see the instructions below). The deadline is March 3, 10 am.
Part I : Getting familiar with client-server programming
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 messaging
system. The system should allow you to log on to a server and exchange messages with other people logged on to the same server.
There are two parts to the application you will write: this is the first part that implements the directory server and a second part that will implement interaction 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.
-
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. For your convenience, here are very short barebones java code for a seqential server and client. Some host names in one of the undergrad labs (LAS 1004) are ptl10,....,ptl23.
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
Part II: Writing a clicker program.
Objective:
The objective of this lab is to write a client and server to implement a clicker. As you know many courses at York use clickers to collect student responses to questions during the class. Clickers are secure and send anonymous responses.
In this part of the assignment your client and server will have the following functionality. The server (designed to run on the instructor's computer) listens for connections on a designated port. The server program has access to the list of student numbers of students enrolled in the class. Clients (running on students' internet connected laptops) connect to the server at the instructor's request and authenticate the student by sending their student number. If the authentication is unsuccessful then the server closes the TCP connection with the client. Otherwise the server sends the number of choices (for simplicity, we assume that the options are numbered a,b,c etc and the number of choices are 2,3,4 or 5.
The client asks the user for input (a,b,c, etc) and sends the choice back to the server and closes its TCP connections. The server receives the data and closes the connection on its side. Then it updates its table of choices received and displays it to the user (instructor). The server should have a LIST functionality using which allows the user to see a list of names of students who responded to a question.
The UI available to the instructor (need not be graphical, a text interface is fine) should support the following commands
-
START_QUESTION(n): starts the server process that runs with n choices.
- END_QUESTION(): Terminate the server process; students can no longer send responses.
-
LIST: Lists students who sent answers.
The UI available to the student user (again need not be graphical, a text interface is fine) should support the following commands
- STUDENT_NUMBER: allows the student to enter their student number.
- CLASS_INFO: allows the student to enter the IP address and port number of the instructor's computer.
- ENTER_CHOICE(): Start a client process, connect to server (using the information above) and send the student number, receive the number of choices, prompt the student user for his/her choice and send this choice to the server an close connection. This part of the program should also be able to process the case where the server program says that the authentication step failed by closing the connection immediately.
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. You can also use the web interface to 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.
Demonstration
The TA will ask you to demonstrate to him that your program works on the departmental Linux machines. You will run the server, and 4 clients and show that the program implements the specifications described above.
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.