Question: Java TCP socket program to do the following (modify the relevant client and server code on Blackboard). Submit your socket code in the files F1

Java TCP socket program to do the following (modify the relevant client and server code on Blackboard). Submit your socket code in the files F1 and F2 (named as above).

1.1 The client

1.1.1 makes a TCP connection to the localhost server (LS) on port 6789.

1.1.2 reads the string with the Web server name W sent to it by the server LS.

1.1.3 makes a TCP connection on port 80 to the Web server W.

1.1.4 creates a correct HTTP Get request automatically and sends it to the Web server W.

1.1.5 prints the text (as is) from the initial page that is received from the Web server W (it should not be an error message since the Get request is correct).

1.1.6 finds and prints the total number of bytes N received from the Web server W.

1.1.7 finds and prints the total time T in milliseconds between sending the Get request and receiving all the text in the page

1.1.8 sends the string W, and the values of N and T to LS over the TCP connection on port 6789.

1.1.9 closes the connection to LS.

1.2 The localhost server (LS)

1.2.1 asks the user to enter a single string with the server name W of a Web server to connect to (for example: www.towson.edu). User will only enter the preceding input (exactly as specified).

1.2.2 reads the string with the Web server name W entered by the user.

1.2.3 waits for the client to connect to it on TCP port 6789.

1.2.4 sends the string with the Web server name W to the client when the client connects.

1.2.5 reads and prints the string W, and the values of N and T sent to it by the client.

Step by Step Solution

3.37 Rating (169 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is the modified Java code for the client and server programs F1 Clientjava java import javaio import javanet import javautil public class Client public static void mainString args try Step 111 Ma... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Network Questions!