CSE 124 : Winter 2016 : Homework 3
Objective
In homework 3, you are going to modify the time/date server you created
in HW2 so that it supports multiple concurrent clients.
Protocol
Your client must send the string 'time' or 'date' to the server, which will
reply back with the time or date in the proper format, as indicated. We will
be testing your server with our own client, and so make sure that you send
'time' or 'date' and not a different, custom protocol.
Concurrency
Modify your server so that each client is handled by a separate thread.
You are free to choose between (1) a model where a new thread is created
and spawned when a request comes in, and (2) a model where a set of
threads already exist in the system (a thread pool), and the
incoming connection is simply passed off to one of those threads
for handling.
Testing advice
To test your server, one possible option is to modify your client
so that it adds delays to sending the commands. For example:
send('t')
sleep(random(...))
send('i')
sleep(random(...))
send('me')
In this way you can start a set of clients and ensure their execution
overlaps.
Logistics
You will turn in HW3 using your GitHub account as before.
Within your repository, which
should be <github_id>_cse124, create a 'homework' directory, and under
that a 'hw3' directory. Note the lowercase capitalization.
Include a Makefile that can be used to build your code by simply typing
'make'. The result should be an application
called 'server', invoked via the above command line arguments.
We should be able to check out your repository, then execute your code
with these commands:
$ cd <github_id>_cse124
<github_id>_cse124 $ cd homework/hw3
hw2 $ make
hw2 $ ./server 9876
At the very least, your repository should contain the following files. You
will of course have other files there too (e.g., your .c and .h files).
gmporter_cse124/
|-- homework
|-- hw3
|-- Makefile
2 directories, 1 files
After calling make, you'll have the following:
gmporter_cse124/
|-- homework
|-- hw3
|-- Makefile
|-- server
2 directories, 2 files
The due date/time are specified on the course syllabus.
- Updates: Jan 26: Clarified the time/date protocol