Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions

Question

Discuss the key ambient conditions and their effects on customers.

Answered: 1 week ago

Question

Be familiar with the integrative servicescape model.

Answered: 1 week ago

Question

Understand the role of corporate design in communications.

Answered: 1 week ago