Académique Documents
Professionnel Documents
Culture Documents
ASSESSMENT SPECIFICATION
Module Details
Module Code Run Module Title
UFCEKP-20-2 08SEP/1 AY Client-Server Programming
Module Leader Module Tutors
Jin Sa Jin Sa, Julia Dawson, Muhammad Tahir
Weighting: (% of the Module's
Component and Element Number
assessment)
B1
50%
Element Description Total Assignment time
Practical Exercises 24 hours
Dates
Date Issued to Students Date to be Returned to Students
To be supplied 26th March 2009
Submission Place Submission Date
PROJECT ROOM - 2Q30 12th March 2009
(Help Desk open 9.00 - 6.00pm)
Submission Time
2.00 pm
Deliverables
See the assignment
You are asked to develop a client-server download centre. On your server, there are
four resources that can be downloaded: iTune , ZoneAlarm, WinRar and Audacity. (In
your implementation, these resources can be represented as strings.)
Here is an example of a typical exchange between the client and the server:
Server says: Here are the terms of reference. Do you accept? yes or no
Client: yes
Server says: 1. iTune 2. ZoneAlarm 3. WinRar 4. Audacity Select a resource for
downloading
Client: 3
Server says: You are downloading WinRar.zip ...
Client: <CR>
Server says: Enter "bye" to exist, and "enter" to continue.
Client: bye
Your application needs to include the different alternatives; for example, the client
may not agree with the terms of references. The application needs to detect bad client
entries, e.g. entering invalid selection for downloading.
Your tasks:
You are required to document, design and implement the application in three stages:
version1, version 2 and version 3.
Version 1:
Implement all the functionalities described above. The client and the server must
adhere to the protocols illustrated. The server must be a concurrent server.
(Hint: You could base your design and implementation on the ideas in the Knock
Knock Joke Socket tutorial
http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html.
However: the Knock Knock programs use some compound if statements. To
improve the readability of your program, you should avoid using the compound if
statement. You should use switch/case statements instead. )
Version 2:
Add a counter for each resource that counts how many times the resource has been
downloaded. Each time a resource is downloaded, the server displays the value of
counter on the server side. (Hint: You need to think about problems with concurrent
threads sharing the same data.)
Version 3:
10% Version 2
o Suitable construct
o Evidence of addressing problem with multiple threads sharing data
10% Logic
o Simple and clear.
o Easy to read and maintain code.
8% Documentation/Commenting
o For each class, method and where necessary
Part 2: Production Diary. (40% of the assignment)
You should write a Production Diary of at least 1000 words. This diary is a
record of your programming planning and development. The diary may be used to
confirm that you have written this code yourself.
You will find it very much easier (and gain more marks!) if you record your progress
as you develop your application rather than leaving it until afterwards.
You can find further information about the diary and an example session entry in
Appendix A (or at http://www.cems.uwe.ac.uk/~jedawson/ufcekp/DiaryTemplate.doc )
Part 1: Hard Copy (printout) and soft copy of computer software system(s) plus
supporting documentation.
Part 2: Hard copy of your Production Diary of at least 1000 words documenting
the plan, the design and the development of the system
Appendix A
Student Name/Number:
You should write a production diary/essay at least 1000 words. This diary is a record
of your programming planning and development. The diary may be used to confirm
that you have written this code yourself.
Use this box to present your overall project plan, timescale and milestones.
=======================================================
Date: Start time: Time allowed:
To be achieved:
Finish time:
Main achievement:
Code version (if applicable):
Next task:
An example of a diary entry
Need to take nasty if/else construct out of Protocol and replace with more
readable/manageable switch statement.
Ref. http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html
Can't remember switch syntax. Googled "java switch case" got useful ref:
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/switch.html
Can use existing values … e.g. WAITING, ANOTHER etc. switch is easy 'cos states
are int already so …
switch (state) {
case WAITING : theOutput = hello(); break;
Other states .. OK can read if/else code form original and translate but need to write
out method names for reference (consistency) …
CODE:
switch (state) {
case WAITING : theOutput = hello() ; break;
case SENTKNOCKKNOCK : theOutput = sendClue(theInput); break;
case SENTCLUE : theOutput = sendJoke(theInput); break;
case ANOTHER : theOutput = sendAnother(theInput); break;
}
return theOutput;
Sample method: