Create a program with a concurrent server using TCP that can handle multiple requests to sort an array of twenty randomly generated words using mergesort that are submitted to the server by each of the clients. The arrays should be created and stored on the clients in a separate input file called “clientn.inputdat”, where n is the client number before starting the program itself. Each input file must have at least three lines with different arrays. At least three clients should be used on at least 2 separate hosts. The clients should be able to read the array from the file and then send it to the server. You should use multiprocessing, not multithreading, on the server. The server must be able to read the file, call mergesort, find the resulting sorted array, and return the sorted resulting array to the client. The client should then print out the result on the terminal. After all arrays in the input file have been sorted correctly, the program should close its connection with the server and exit the program. Be sure to use a waitpid () system call before exiting the server after all of the clients have been serviced so that no zombies are left when the server leaves. You will need to use such commands as fork(), accept () and waitpid ( ). Write the program in C or Python in Linux.


0 comments