CS2105 Assignment 2
CS2105 Assignment 2
School of Computing
Submission Deadline
31st March (Friday) 11:59 pm. 2 marks penalty will be imposed on late submission
(Late submission refers to submission or re-submission after the deadline). The sub-
mission folder will be closed on 7th Apr (Friday) 11:59 pm.
Objectives
In this assignment, you will implement a client and server for file transfer. After com-
pleting this assignment, you should
• be able to construct application layer packets
• have a good understanding of communication protocol design.
Group Work
All the work in this assignment should be done individually. However, if you find the
assignment too difficult,
• you are allowed to form a group with another student
• maximum two students per group.
• Group submission is subject to 2 marks penalty for each student.
Under no circumstances should you solve it in a group and then submit it as
an individual solution. This is considered plagiarism. There will be no acceptance
for excuses such as forgetting to declare as group submission. Please refer to the
"Special Instructions for Group Submission" and "Plagiarism Warning" on page 2 for
more details.
Grading
• We accept submission only of Python 3 (3.8.10 in particular) programs.
• Programming languages other than Python 3 are not allowed.
• We will test and grade your programs on the stu server. Please make sure that
your programs run properly on stu and not only on your own system.
• By default, we use the python3 program installed in folder /usr/bin/python3 on
stu for grading. Unless stated otherwise for individual tasks, you are allowed to
use libraries installed in public folders of stu (e.g. /usr/lib) only.
Page 1 of 6
• Your programs will be graded automatically using scripts.
– Please make sure that your programs behave exactly the same as described
in this document, because the grading scripts are unable to award partial
marks.
• A set of testing scripts is released to you in the assignment package.
– These test scripts cover common cases that your programs are expected to
handle.
– During actual grading, we will use extra cases to test your programs. Hence,
passing all the released test cases does not guarantee that you will get full
marks.
– In addition, we will detect fraudulent cases such as hard-coding answers
within programs and deduct marks accordingly.
We will deduct 1 mark for failure to follow instructions.
Program Submission
• For individual submission, please name your two source file as Server-<Matric
number>.py and Client-<Matric number>.py; and submit it in a single zip file
<Matric number>.zip, to the Assignment_2 on canvas.
• Here, <Matric number> is your matriculation number which starts with letter A.
An example file name would be Server-A0165432X.py.
• Note that file names are case-sensitive on stu.
You are not allowed to post your solutions to any publicly accessible site on the
Internet.
Plagiarism Warning
You are free to discuss this assignment with your friends. However, you should refrain
from sharing your program, program fragments, or detailed algorithms with others. If
you want to solve this assignment in a group, please do so and declare it as group
work.
Page 2 of 6
We employ zero-tolerance policy against plagiarism. If a suspicious case is found, the
student would be asked to explain his/her code to the evaluator in face. A confirmed
breach may result in zero marks for the assignment and further disciplinary action from
the school.
FAQ
We will collate your questions here: link
Page 3 of 6
Figure 1: Architecture.
Page 4 of 6
Figure 3: Reliable channel FSM.
• Since you have 2 programs, you will be running them on 2 separate terminals
• Your program should receive five command-line argument as the following com-
mand shows:
python3 Sever-A0165432X.py <ip_address> <port_num> <input_file_name> <mode> <st
key>
python3 Client-A0165432X.py <ip_address> <port_num> <output_file_name> <mode> <s
key>
– <ip_address>: The IP address of the machine on which the simulator is running.
– <port_num>: The port number of the TCP socket corresponding to the simulator.
– <input_file_name>: The file to be transferred
– <output_file_name>: The destination file name
– <mode>: Is the integer input corresponding to the simulator we are connecting to
– <student_key>: The 6 digit key is the same as the one used in Assignment_1.
• During the evaluation, we will change the input files, the IP address and the port
number; hence your code should accept all the above mentioned command line
parameters.
• Note that your program should not read from stdin.
• Your program can print anything to stdout or stderr, and our test script will
silently ignore them.
• We also release a set of grading scripts to you under the test folder.
• To use the grading script, please upload your program along with the test folder
given in the package, to stu. Ensure that your program and the test folder are
Page 5 of 6
Figure 5: Reorder channel FSM.
in the same directory. You can run the following command for help:
bash test/FileTransfer.sh -h
• To run the test script for the server, kindly use the -s option
All of you will be connected to a single simulator, hence start the assignment early to
avoid "congestion" during the last few days.
Template
We have released the template of the code.
Enjoy!!!
Page 6 of 6