Question: Write an echo server which performs the same job as your echo process above using the Java networking API we covered in class (look at

Write an echo server which performs the same job as your echo process above using the Java networking API we covered in class (look at the Data client and server example. The server should wait for a client connection using the accept() method. When a client connection request is received, the server will loop, performing the following steps: - Read data from the socket into a buffer. - Write the contents of the buffer back to the client. The server should exit from the above-described loop only when it has determined that the client has closed the connection (i.e., the result of the read operation is NULL), continuously inputs a string from the user via the keyboard, sends the string to the server, and prints whatever it receives from the server to the console. This process should repeat until the user types -1, upon which the client closes the connection and exits. Different from the second process above in Question 2, the server need not exit but runs forever waiting for client requests.

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!