Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a server program and a client program in C that will be run concurrently. Server program: The server program provides a simple search for

Write a server program and a client program in C that will be run concurrently.

Server program:

The server program provides a simple search for a specific value in an array sent to it from a client. If the value appears in the array, the server indicates the index of the first occurrence of that value in the array. The server sends the client search value and its array position. If the value does not occur in the array, only the search value and an appropriate return code is returned to the client.

The server program needs to:

  • Determine an integer value to be searched for
  • Create a well-known FIFO, named FIFO_to_Server through which the server reads inputs from the client
  • Open FIFO_to_Server in READ mode
  • Read a request from a client that includes a struct containing a size integer and array values of that size, all integers.
  • Find the index (start counting with zero) of the search value, if one exists
  • Create a FIFO named FIFO_to_Client through which the server responds to the client
  • Open FIFO_to_Client in WRITE mode
  • Write the search value and the index position back to the client through FIFO_to_Client
  • Close FIFO_to_Client
  • Unlink FIFO_to_Client
  • Close FIFO_to_Server
  • Unlink FIFO_to_Server

Client Program:

The client program will request an array size and array elements to fill the array. The client program should:

  • Open FIFO_to_Server in WRITE mode
  • Prompt the user for an array size
  • Prompt the user for elements to fill that array
  • Write the struct that includes the array size and the array to FIFO_to_Server
  • Close FIFO_to_Server *
  • Open the FIFO_to_Client in READ mode
  • Read the response from the server from FIFO_to_Client
  • Print a message such as The value 87 occurs in array position 4
  • Close FIFO_to Client

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

DB2 11 The Ultimate Database For Cloud Analytics And Mobile

Authors: John Campbell, Chris Crone, Gareth Jones, Surekha Parekh, Jay Yothers

1st Edition

1583474013, 978-1583474013

More Books

Students also viewed these Databases questions

Question

=+function g such that A[ x (0, 1): f(x) + g(x)]

Answered: 1 week ago

Question

Write down the Limitation of Beer - Lamberts law?

Answered: 1 week ago

Question

Discuss the Hawthorne experiments in detail

Answered: 1 week ago

Question

Explain the characteristics of a good system of control

Answered: 1 week ago

Question

State the importance of control

Answered: 1 week ago

Question

b. What groups were most represented? Why do you think this is so?

Answered: 1 week ago

Question

3. Describe phases of minority identity development.

Answered: 1 week ago

Question

5. Identify and describe nine social and cultural identities.

Answered: 1 week ago