Question: This is unix. Design and implement one Server (a4p1Server.c) and one client (a4p1Client1.c). The concurrent server is up and listening. The server (when it starts)

This is unix.

Design and implement one Server (a4p1Server.c) and one client (a4p1Client1.c).

The concurrent server is up and listening. The server (when it starts) takes one argument (its port number) to bind and listen for a client to be connected. The server has a pool of threads of which each thread will serve each client when it is connected. Each thread can be created either (1) in the beginning of the server as it starts or (2) when a client is connected.

Once the server is up and listening, the client connects to the server and runs in a loop. The client (when it starts) takes three arguments (of IP address, Port number of the server, and log-file name) to be used to connect.

The client is running a loop: (1) to receive a transaction from the user (you), (2) to send it to the server, (3) to wait and then receive the result from the server, (4) to display the result to the console, and then (5) to go back in the loop. For each step, the client displays the hostname and date of the client and you may use: system("hostname; date"). When the client gets a transaction ("exit") from the user, it will send this to the server (to terminate its connection), and then the client terminates its execution.

The client sends a transaction (e.g., a command such as "date") to the server to be processed. Once the client is connected to the server, the server let its worker thread to serve the client, to receive a transaction, to run it, and then to send its result back to the client.

The server assigns its worker-thread to serve the client. Then the worker-thread goes in a loop: (1) receive a transaction from the client, (2) to process the transaction, (3) to send its result back to the client, and (4) to go back in a loop. For each transaction in loop, the worker-thread displays: (1) the thread information (the thread id), (2) the server information, (3) the hostname and the date/time of the transaction being processed, (4) the transaction from the client, and (5) the result of the transaction to the server console

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!