CS422 Project: Socket-based Network Programming
|
3.1. A file server in TCP
The source code of both client side and
server side is on page 490-491 of the textbook; downloadable at http://www.prenhall.com/tanenbaum.
Current client code displays the (text) file on the standard output. Modify
client side so that a binrary file, transferred from the server, will be saved
as a file in the local directory. Make both sides running on Unix computers in
Lab 138. Since Unix machines are sharing the same file system, you may create a
new directory to save the received file at the client side.
Server side: TCP_server
Client side: TCP_client server_hostname filename
TCP_client is the executable program. server_hostname
is the hostname of the machine you use as the server (use windom). filename is
the file that client wants to read from the server. We assume that the server
has the requested file (you can store several PDF files there). Use the PDF
file TEST FILE to test your programs. You
may use binary I/O in the file operations. You may also want to save the
transmitted file in a different directory due to the use of a shared file system
in our Linux computers in Lab 140. You should be able to open the test
PDF file on the client machine after the TCP transmission is completed. Note
that you may use 2XYZ as the port number in your program, in which XYZ are the
last 3 digits of your student ID. Doing
so would avoid that multiple programs/processes use the same port for
communication.
3.2. A file server in UDP (with flow control)
Modify the source code of 3.1 using UDP
sockets, instead of TCP sockets. Make both sides running on Linux computers in
Lab 140. See UDP Client in C and UDP Server in C for reference. Then, enhance the reliability of your code
of 3.2(a) by implementing two ARQ algorithms; stop-and-wait (SW),
and one of go back N (GBN) and selective repeat (SR).
Refer to section 3.4 on pages 211-229 of the testbook for
sequencing, ACKs, and retransmission mechanisms.
The communication should be reliable, assuring that the
client got whole file correctly. Since UDP indeed is indeed quite reliable for
communications within a LAN, use a random generator/function to purposely drop
X% of data blocks BEFORE they are delivered from the server side.
Each UDP segment should be less than 4KB, so that you can have enough segments to
experience a few segment losses.
Server side: UDP_server loss_probability protocol_type
Client side: UDP_client server_hostname file_name protocol_type
Parameter loss_probability is the dropping probability (an integer) as a command-line input of the
server code. Parameter protocol_type is the ARQ type implemented (1 for SW, 2 for GBN, 3 for SR).
server_hostname is the hostname of the machine you use as the
server (e.g., use WINDOM server). filename is the file that client wants to read from the
server. Clearly, we assume that the server has the requested file. Use the PDF
file TEST FILE to test your programs. You
should be able to open the test PDF file on the client machine.
You may want to save the transmitted file in a different directory due to the use of a shared file system
in our Unix/Linux computers.
Again, you may
use 2XYZ as the port number in your program, in which XYZ are the last 3 digits
of your student ID. Doing so would avoid
that multiple programs/processes use the same port for communication.
What to turn in:
Two
of you are encouraged to team up. If you work individually, NO bonus.
For
this project you will email me at zbo@cs.uccs.edu one
ZIP file (in the name of P2_Yourlastnames) of all source code, together with a
technical report specifying 1) teammates' name and email address; 2) how to
compile and execute your program; 3) the self-testing results of your program and
any important feature you want to specify (if your program does not work,
please notify it clearly). Your program should print the trace of flow control
for the lost frames (i.e., Seq#, ACK#, Retransmission#) into an output text file;
(4) teammate evaluation data specifying the workload
percentage distribution between you and your teammate(s). Each teammate will
specify his/her own evaulation data about his/her teammate(s)' workload in the project,
say "I did 50% of the work and my teammate did the other 50%; or I did 60%
and my teammate did only 40%. If no specification, the default is 50-50,
before the due time. Please also have the project report in a hardcopy at the demo time.
Make sure your code can work in machines in Lab 140. We may
go to Lab 140 during the class time to check your project. Or, you can bring your
own laptop to demonstrate
You
may search the Internet for more helpful information on socket-based network
programming, one example is http://www.uwo.ca/its/doc/courses/notes/socket/ .