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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started