Question: Using C socket programming language Write a concurrent TCP server program according to the following requirements: 1. the server should keep track of how many

Using C socket programming language
Write a concurrent TCP server program according to the following requirements:
1. the server should keep track of how many clients connected to the server
2. after a client request to connect with the server, the server should fork a child process to handle that request
3. the child process should call the function int receiveAndSum(int skfd)
4. The function receiveAndSum
a. should read exactly 5 integers from the client where the client will send the numbers individually (assume Writen function discussed in the class is already implemented and is available for you to use.)
b. Once all the numbers are received, the function will compute and send the sum of the 5 numbers back to the client
c. the function should also return the summation result
5. the child process should store the returned result in the array magicallySharedArray, which you can assume is shared between the parent process and all its child processes.
6. After 4 clients are done providing their numbers, the server should find maximum summation (out of those already stored in the magicallySharedArray) and print it.
7. All socket descriptors should be closed properly
8. The server should listen on port 5555
9. The server would accept connections on any of its interfaces
10. The server must wait for 4 clients (connecting to server via forked child processes) to send the required data.

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!