Question: 1. Client-Server Application: Write a client and multi-threaded server application in Java that does the following: Client sends 9 positive numbers as a whole to
1. Client-Server Application: Write a client and multi-threaded server application in Java that does the following: Client sends 9 positive numbers as a whole to the server so that the server can return the sum of them. When server receives the numbers, it splits the number into 3 equal chunks to be distributed to 3 threads. When each thread receives its own chunk of numbers, it computes their sum and writes it to a shared location. When all threads complete performing their tasks, the server sends the resulting sum to the client. See an example below.
This code must be Java
Client: Server: Sends the following numbers to server: 1, 5, 9, 10, 20, 25, 90, 10, 100 Client receives the sum 270 Receives the numbers from client Server creates 3 threads and Sends 1, 5, 9 to Thread-o Sends 10, 20, 25 to Thread-1 Sends 90, 10, 100 to Thread-2 Thread-o performs its task and writes the sum 15. Thread-1 performs its task and writes the sum 55. Thread-2 performs its task and writes the sum 200. Server sends 270 to client
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
