Sale!

CpSc 3600-001 Homework 4: Concurrent TCP Client/Server Program

$30.00 $18.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (2 votes)

This project is to write concurrent TCP client and server programs in C or C++. Your programs should have the following functions:

TCP Client

Your client first sends a message to the server, indicating the name of an ASCII file to be sent to the server. Then your client waits for an ACK message from the server to start sending the data. The client also receives the filename (different from the one sent by the client) that the server will use to store the received data within this first ACK message. After that, the client reads one line at a time from the file and sends to the server. The client needs to get an ACK message from the server before sending the next line. The client may receive an error message from the server during the transmission. If an error message is received, the client should report the error and exit.

Below is an example of a command line that could be used to run your TCP client on port 1234 and send a file specified by “myfile” to the TCP server at address 130.127.45.7:

./client  130.127.45.7  1234  myfile

The first command line parameter (argv[1]) must be the TCP server’s IP address.
The second parameter (argv[2]) is the port number that will be used by both the client and server programs.
The third parameter (argv[3]) is the name of the ASCII file to be sent to the server.

TCP Server

Your server creates a TCP socket and waits for the client to send data at a port specified by the command line parameter. The server first receives the filename from the TCP client and create an ASCII file for writing. Since this is a concurrent server, your server must create a filename that not only reflects the original filename in the client but also avoids the name conflict with the other clients. After the file is created, the server should send an ACK message along with the filename to the client so that the client can start the data transmission. The server will then read ASCII data line by line sent by the client, and reverse the order of characters in each line and write it to the file opened by the server. The server must send an ACK message for each line it receives. Below is an example of a command line that could be used to run your TCP server on port 1234:

./server 1234

You must implement your concurrent TCP server using multi-thread method.

What is required:

  • You must design an appropriate application layer protocol for your client and server communication.
  • You must implement the server using multi-thread.
  • Your server must avoid filename conflict from multiple clients. For instance, you can use the combination of the filename from the client and the time that the request is received as the server-side filename.
  • Your client must send the file line by line. You can not send the file at once or character by character.
  • Your client should tell the server when it finishes sending the file.
  • Your server must reverse the order of characters in each line and store the reversed line in the proper server-side file.

Deliverables

You must submit all the source code necessary for us to build and test your concurrent TCP client and server. These files must include server programs and one client program. You must also include Makefile that can be used to build your client and server on the CS Linux workstations.

You must also include in your submission a file named README that includes your name and a brief description of your submission, including the name of each file submitted along with a one line description of what is in the file. If your code is not complete, tell us what works and what doesn’t. If you are submitting code that does not compile, please tell us that as well. If any of your code was written by someone else, you are required to tell us about it (this must also be documented in the code itself). Finally, feel free to include a description of any problems you had or anything else you think might be helpful to us.

Grading

Your project will be tested to make sure it works properly. Here is a rough breakdown of the grading:

Multi-thread TCP Server 60%
TCP Client 20%
Submission, Error handling, Style/Code structure, etc. 20%

NOTE: 20% of your homework grade depends on the how “well your code is written”. These points include the following:

  • Error handling (check every system call for an error!).
  • Safe code (avoiding buffer overflow, etc).
  • How well we can understand your code. There is no required format for your code, there is no requirement like “you must have one comment for every 5 lines of code”. Feel free to provide whatever level of commenting you believe is appropriate to make sure that other competent programmers could easily understand and make changes to your code.

Submitting your files

All projects must be submitted via handin: https://handin.cs.clemson.edu

Please make sure you submit all your source files not the object files.  You can also zip the files using the following command first:

          > tar   cvzf   hw4.tgz   file1  file2   file3  …

and submit the single zip file hw3.tgz.  Before you submit this single file, please use the following command to check make sure you have everything in this zip file:

            > tar   tvzf   hw4.tgz

Don’t send compiled code! Please ask question if you don’t understand any part of this project.

Resources/Links:  Please see the sample codes of the book.