Question: Write a new socket client and a socket server that can transfer a text file over TCP. Use the attached text file (PoemShakespeare.txt). a .

Write a new socket client and a socket server that can transfer a text file over TCP. Use the attached text file (PoemShakespeare.txt).

a. Your TCP client should read the text line by line from the file and send it to the server, which displays each line received at the console.

b. Once all the lines in the poem are sent to the TCP server, the client should further send a Done message to signal the end of the file transfer to the server, and the server responds to the client a Bye message. The above two messages exchanged between the client and server should be case-insensitive. Note: the server can only send out the Bye message after the server checks that the Done message from the client has been received.

c. Only after receiving the Bye message, should the client close the connection with the server, and display the total number of data sent in bytes and the total time in milliseconds spent in file transfer. This total time is counted from the moment before the client sends the first line to the moment after the Bye message is received.

Write a new socket client and a socket server that can transfer

Please write it in Java Program (mandatory). Thank you

Poem Shakespeare.txt - Notepad File Edit Format View Help Blow, Blow, Thou Winter Wind William Shakespeare Blow, blow, thou winter wind Thou art not so unkind As man's ingratitude; Thy tooth is not so keen, Because thou art not seen, Although thy breath be rude. Heigh-ho! sing, heigh-ho! unto the Most friendship if feigning, most Then heigh-ho, the holly! This life is most jolly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!