Assignment Chef icon Assignment Chef

[Solved] CS3700 Homework3-simplified HTTP protocol based on TCP service

5.0 1 customer review Digital download

Digital download

$25.00

Availability
In stock
Checkout
One item

Need a hand?

Message us on WhatsApp for payment or download support.

WhatsApp QR code
Part I: Write a client program and a server program to implement the following simplified HTTP protocol based on TCP service. Please make sure your program supports multiple clients. The webpage file CS3700.htm is provided. You may choose a port like 5678 and hard code it in both client and server programs. (Hints: for testing both programs on the same computer, you may want to put client program and server program at two different directories. Do NOT hard code the file name CS3700.htm!) The ending signature of the entity body in the HTTP response message for the case 200 OK: The request line (hint: the URL should include a / in front of the htm file name) The header line for the field Host: The header line for the field User-Agent: <empty line>
  1. Receive and interpret the HTTP response message from the HTTP Server program line by line, display the RTT (File Transmission Time may be included) of HTTP query in millisecond (the difference between the moment right before HTTP request is sent and the moment right after HTTP response is received) as a single line (e.g., RTT = 1.089 ms), display the status line and header lines of the HTTP response message on the standard output, and save the data in the entity body to a .htm file to local directory if there is any. (Hint: (a) When one empty string (NOT a null string!) is read the FIRST TIME, it indicates the header lines are over and the entity body is going to start next line if the case is 200 OK.)
  2. Display a message on the standard output to ask the User whether to continue. If yes, repeat steps 3 through 6. Otherwise, close all i/o streams, TCP connection, and terminate the Client program.
o If the method given in the request line is NOT GET, it is a 400 Bad Request case o If the file specified in the URL does not exit/cannot be open, it is a 404 Not Found case o Otherwise, it is a 200 OK case
  1. According to the case discovered above, construct ONE HTTP response message and send it to the HTTP client program over the TCP connection. Your HTTP response message needs include the following lines using the HTTP message format. (Hint: At the end of each line including those empty lines, a r is needed.)
The status line The header line for the field Date: The header line for the field Server: , you may use any value of your choice <empty line> Data read from the requested HTML file line by line (hint: for the 200 OK case only) <empty line> <empty line> <empty line> <empty line>
  1. Repeat Step 3 through 4 until a null is read. (Hint: this happens when THIS client closes the TCP connection.)
  2. Close all i/o streams and the TCP socket for THIS Client, and terminate the thread for THIS client. (Hint: when this happens, the parent thread is still alive doing Steps 1 and 2 forever, unless the Server process is killed/terminated.)
Part II : Test your programs on the Virtual Servers in the cloud and your laptop/home computer. Warning: to complete this part, especially when you work at home, you must first (1) connect to GlobalProtect using your NetID account (please read how to connect to GlobalProtect at https://msudenver.edu/vpn/); then (2) connect to the virtual servers cs3700a and cs3700b using sftp and ssh command on MAC/Linux or PUTTY and PSFTP on Windows.
ITS only supports GlobalProtect on MAC and Windows machines. If your home computer has a different OS, it is your responsibility to figure out how to connect to cs3700a and cs3700b for programming assignments and submit your work by the cutoff deadline. Such
issues cannot be used as an excuse to request any extension.
  1. MAKE a directory HW3 under your home directory on cs3700a.msdenver.edu and cs3700b.msudenver.edu, a subdirectory server under HW3 on msudenver.edu, and a subdirectory client under HW3 on cs3700b.msudenver.edu.
  2. UPLOAD and COMPILE the server program under HW3/server and the client program under HW3/client on the VMs.
  3. TEST the server program running on cs3700a.msudenver.edu together with a client program running on your laptop or lab computer and another client program, simultaneously, running on cs3700b.msudenver.edu to test all the possible cases.
  4. SAVE a file named txt under HW3/client on cs3700b.msudenver.edu, which captures the outputs of your client program when you test it. You can use the following command to redirect the standard output (stdout) and the standard error (stderr) to a file on UNIX, Linux, or Mac, and view the contents of the file
java prog_name_args | tee testResultsClient.txt //copy stdout to the .txt file //if you want, you may also use script command instead of the tee command //to write both stdin and stdout into testResultsClient.txt while testing your //client program on cs3700a. For how to use script, see // https://www.geeksforgeeks.org/script-command-in-linux-with-examples/ //or Google script command in Linux if the above link is broken. cat file-name //display the files contents.