Course: CISC450/650 ELEG651 CPEG419 Computer Networks
Professor: Paul D. Amer
Title: Project/Program 1 - Simple File Transfer over
TCP or UDP
Assignment last updated: 2/26/2015
Due Date:
Tasks
REQUIREMENT: For all parts, the client and server MUST run on different computers,
not over a single machine's loopback interface. Afterall, this course is networking!
-
(10pts) Starting Easy
-
Read about TCP and UDP client-servers in Section 2.7.
Note: the textbook's programs are named TCPClient, TCPServer, UDPClient, and
UDPServer. More meaningful names would be:
MakeUpperCaseClientUsingTCP, MakeUpperCaseServerUsingTCP,
MakeUpperCaseClientUsingUDP, and MakeUpperCaseServerUsingUDP, respectively.
It's important that you understand why these names are more meaningful. Do you?
- Read about sockets in Python (e.g., http://docs.python.org/3.1/howto/sockets.html).
- Install, change the names to the ones suggested, and execute Chapter 2's TCP and UDP client-servers.
The client and server must be run on two DIFFERENT machines.
Note: the textbook's Python programs can be cut and pasted from www.cis.udel.edu/~amer/650/Assignments/KuroseRoss-6ed-Section2.7-TCP-UDP-clients-servers.py
- REQUIREMENT: Add appropriate, meaningful header comments to both the client and server.
See Amer's coding standard.
- REQUIREMENT: SUBMIT in class paper copies of your 4 scripts showing your source code and that it compiles,
and then demonstrating that your client-servers
work as described in the book.
Your submitted output MUST provide evidence that your client and server are running on different machines.
For example, here is a script for the MakeUpperCaseClientUsingTCP. You will need to
submit analogous scripts for the other three modules.
- start script for MakeUpperCaseClientUsingTCP
- uname -a /* you MUST show name of machine that this module is executing on */
- cat MakeUpperCaseClientUsingTCP.py /* show code */
- execute MakeUpperCaseClientUsingTCP /* start the module */
- ... /* output feedback showing the module's actions */
- end script
- REQUIREMENT: Normally on assignments groups may not interact.
As an exception, for this part only, after getting your client-servers working, groups MUST test their
code with at least one other group. For example, Group A runs their server on a
machine, and tells Group B the machine name and well-known port. Then Group B modifies their client
to use Group A's server. Then Group A and B switch roles. SUBMIT: a brief description
of which group you tested with, and the results of the test. Be honest, you are not
graded on whether or not your code worked the first time.
(35pts) Simple File Transfer using TCP
- Write an FTP client-server application where the client (1)
prompts a user for two items:
a destination file server machine name or IP address,
and the name of a file supposedly stored on the destination file server,
and (2) then uses TCP to ask the server to transfer the file back over
TCP to the client. Your client-server should use 2 TCP connections; one
for Control PDUs, and one for transferring the file.
- Before the file is transferred,
the client sends the filename to the server; the
server checks if the file exists and returns a status (yes or no).
If no, the client tells the user that the file is unavailable.
If yes, the file is transferred.
Be sure to clearly comment what the client and server do.
- REQUIREMENT: Your client and server must be named: FTPClientUsingTCP.py and
FTPServerUsingTCP.py, respectively.
- The client/server textbook examples are designed for
interactive input (the client reads input using "readline.") Ideally
your FTP programs should be able to transfer any type of file: text or
binary, and therefore should not use "readline" or any input method that
assumes lines of text. (A binary file may have no newline characters in it.)
- Your client/server may hard code a "well-known" port number on the file server.
- You may assume the file to be transferred is no larger than 5,000 bytes.
- REQUIREMENT: In FTPClientUsingTCP, if a connection fails, trap the exception,
and output a meaningful message such as "FTPClientUsingTCP: Unable to open
TCP connection to HOST X at PORT Y", and terminate gracefully. If the file to
transfer does not exist at the server, the server should tell the client, and
the client should print an appropriate message.
- REQUIREMENT: Transfer a file of at least 2000 bytes.
- REQUIREMENT: SUBMIT in class paper copies of your two programs: FTPClientUsingTCP.py and FTPServerUsingTCP.py
- REQUIREMENT: UPLOAD your two programs: FTPClientUsingTCP.py and FTPServerUsingTCP.py to the class Sakai site
- REQUIREMENT: SUBMIT in class paper copies of 4 scripts,
2 for the case that the file to transfer is not on the server, and 2 when the file is
on the server. For each case, show
one script demonstrating FTPServerUsingTCP running on the server; and
one script demonstrating FTPClientUsingTCP running on the client.
For example:
File NOT on server
- start script for FTPServerUsingTCP
- uname -a /* you MUST show name of machine that server is executing on */
- ls -l /* show files that exist on the server */
- execute FTPServerUsingTCP /* begin the server process */
- ... /* feedback indicating the failed file transfer */
- end script
- start script for FTPClientUsingTCP
- uname -a /* you MUST show name of machine that client is executing on */
- ls -l /* show files that exist at client (file to transfer should NOT appear on client) */
- execute FTPClientUsingTCP /* begin the client process */
- ... /* feedback showing the failed file transfer */
- ls -l /* show that no file has been transferred to client */
- end script
File on server
- start script for FTPServerUsingTCP
- uname -a /* you MUST show name of machine that server is executing on */
- ls -l /* show files that exist on the server */
- execute FTPServerUsingTCP /* begin the server process */
- ... /* feedback indicating the file transfer */
- end script
- start script for FTPClientUsingTCP
- uname -a /* you MUST show name of machine that client is executing on */
- ls -l /* show files that exist at client (file to transfer should NOT appear on client */
- execute FTPClientUsingTCP /* begin the client process */
- ... /* feedback showing when the file to transfer does exist*/
- ls -l /* show file has been transferred to client */
- end script
(35pts) Simple File Transfer using UDP
- Analogous requirements as previous question, but using this time the client-server
must use UDP to transfer the file.
- REQUIREMENT: Your client and server must be named: FTPClientUsingUDP.py,
FTPServerUsingUDP.py, respectively.
-
UDP provides unreliable transport service (i.e., no
guarantee of delivery, no guarantee of ordered delivery, no guarantee that
duplicate UDP-PDUs are not delivered to the receiving application).
So your client-server application must implement a mechanism to provide reliablity.
Your comments MUST clearly document whatever method you choose.
- For example: Before the file is transferred, your
client-server may open a TCP "control" connection, for exchanging control FTP-PDUs.
Over this control connection,
the client sends a filename to the server; the
server checks if the file exists and returns a status (yes or no), and if yes,
perhaps an MD5 hash of the file.
The file itself is then transferred over UDP.
After the file transfer, the client computes an MD5 hash on the
received file and checks if the hash value matches what the server
previously sent. If not, the file transfer fails and an appropriate message is
output to the user. (A full application layer FTP over UDP would have to
implement timers, and retransmissions. You do not have to do that.)
- REQUIREMENT: SUBMIT in class paper copies of your two programs:
FTPClientUsingUDP.py, FTPServerUsingUDP.py
- REQUIREMENT: SUBMIT in class paper copies
of 4 scripts analogous to above, showing FTPServerUsingUDP and
for FTPClientUsingUDP in action.
- REQUIREMENT: UPLOAD your two programs:
FTPClientUsingUDP.py, FTPServerUsingUDP.py to the class Sakai web site.
Rules
- For this assignment, students may work in groups of 2.
If you do not know Python, now is the opportunity to learn.
Find a partner who is Python proficient.
- Groups should submit one answer clearly identifying
both partners. In total, 8 well-labelled (e.g., "Part 1 MakeUpperCaseClientUsingTCP") scripts should be submitted in class, and 4 programs need to be uploaded to the class Sakai web site.
-
Students may get assistance with general Python language questions
from anyone. Try your best to debug your own programs.
- Clearly document your well known port numbers, and the handling of the control connection in Questions 2 and 3.
- Programs are expected to be professionally prepared.
- In the header of every module, comment your Name, Date, Course, Project, and Project Description.
- REQUIREMENT: All code within the module must be commented.
- REQUIREMENT: All variable names must be meaningful. The following varible names are not
meaningful: x, data, value, number, count, input, infile, done.
- REQUIREMENT: Readability of your ouput including consistency of indentation is vital.
PRINTED SOURCE LISTINGS WITH LINES THAT WRAPAROUND TO THE NEXT LINE MAKE THE CODE UNREADABLE. They will be returned without being graded.
- See Amer's coding standard.
- Academic Honesty: A clear distinction exisits between
getting general help from other students, and having someone else write
your program. A student is responsible for understanding each and
every line of code that s/he submits. You are all advanced computer
science students, and by now should have a clear understanding of how much
outside help one is permitted. When in doubt, ask the professor.
Do NOT copy and edit another past or present student's program, and submit
it as your own. It is better to not turn in an assignment, and accept
the grade penalty than to be academically dishonest.
Grading
- Submit your answers clearly labeled and IN ORDER (-2 points otherwise) -
all papers dealing with Question 1, followed by all papers
dealing with Question 2, followed by all papers for Question 3.
- correctness (60%)
- readability and documentation - comments, variable names, consistency of spacing
and indentation (40%).