CS635 01 Summer II                            Assignment 3:  TCP/IP Network Programming
Due 08/10/2017

Develop TCP/IP client/server C/C++ programs to simulate the full-duplex stop-and-wait data link protocol:

1. Write a connection-oriented File Server (FS) program to do the following:

a. Print the FS address (hostname, port_number, server name) on the screen.
b. Accept a connection request from the client.
c. Fork/Create a child process/thread to process the client request:
    Receive the file uploaded from the client in a number of data frames using the stop-and-wait protocol with Positive and Negative acknowledgment.
FRAME data structure used should be the same as your previous assignment.
 

2. Write a client C program to do the following:

a. Connect to the FS server using the FS address printed on the screen.
b. Upload an image file to the FS server simulating the stop-and-wait protocol with
    Positive and Negative acknowledgment. Simulate the transmission errors by using random number generating function.
(Optional: To develop a full-duplex TCP connection on the client side so that it can send data packets and read acknowledgement at the same time by two different processes/threads.)

Protocol specifications:

a. Client and FS server communication should use the TCP/IP connection-oriented service.
    The FRAME data size is limited to 4K-byte and 1-bit sending window size should be used.
    You should use the sleep() function to simulate the transmission delay and message rate.
b. FS server must be a multi-process/multi-thread program to be able to serve multiple clients.
c. Assume the Data frames have 25% transmission errors, but they will not be lost.
    Short ACK/NACK frames will not have transmission errors. The server program will compute the checksum for simulating the transmission error.
   (Therefore no timer is needed to simulate this protocol.)
d. Using a random number generator (rand(...)) to simulate the transmission errors.

Compile the programs on cs99 using “gcc programName.c –o programName” or “g++ programName.cpp –o programName 

(Or use “gcc programName.c cpplsocketlnsl –o programName” or “g++ programName.cpp –lsocketlnsl –o programName” if needed on other UNIX machines.)

Testing

a. Start the FS server on CS99 machine and print the FS server address on the screen.
b. Start the Client on CS99 (extra credit if start on a machine other than CS99) and then send the request to the FS server for uploading a large (at least 1MB) image file.

(Find the FS server address on the screen.)

Assignment hand in policies

Write a Microsoft word report to describe the execution environment and run results with the full screen shots, including the time stamps.
Submit your report and C/C++ program codes on the Sakai class web site Drop Box before the due day.