Question: Task 2 : Echo Server The provided starter code is a barebones implementation of a server and a client. The client accepts input from the
Task : Echo Server
The provided starter code is a barebones implementation of a server and a client. The client accepts input from the keyboard and sends it to the server, which then prints it to the screen.
Modify the provided code so that the server sends the data back to the client instead of printing it to the screen. Upon receiving the data, the client should then print to the screen. This should lead to the client accepting a line of input, sending it to the server, reading that back from the server, and then printing it to the screen.
Why would you ever do this? It turns out to be a good start for building a networked program or for testing that the connection is properly set up
Note: The provided code uses port in both the client and the server. Since this program may be run on university machines and at the same time as the solutions written by others in the course you will need to choose a different port. You may use any number between and The department servers will not generally allow connections from the outside on arbitrary ports. You can test your program between two department servers eg unix and unix but not likely from a different computer connecting to a department server. If you are running on your own machine, then you can, again, choose a port and then connect to the server on localhost.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
