Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Assignment #1 CSCI 4534 This assignment is meant to: Introduce students to writing basic client/server programs in C using the UNIX platform Provide an

Programming Assignment #1

CSCI 4534

This assignment is meant to:

Introduce students to writing basic client/server programs in C using the UNIX platform

Provide an opportunity to write code that will become the base for projects similar to that of an operating systems memory manager

This assignment requires the analysis, implementation, testing and documentation of two C program that use C on the UNIX server sapphire. A server program and a client program that will be run multiple times. As described in the following figure (From Advanced Programming in the Unix Environment Book).

Server program:

The server program will provide an echo service to the clients, i.e., whatever data the client sends to the server through the well-known FIFO, it will be returned to the sending client through that clients specific FIFO.

Server program will need to:

Create the will known FIFO where it will read its inputs from clients and open it n READ mode

Then go into a loop to read requests from clients, requests from clients will be of two types:

Requests from new clients asking to connect to the server, this requests should include the client number and the name of that client-specific FIFO. Server should open that FIFO in WRITE mode, save the file descriptor for that FIFO, associate it with that client number and return to the top of the loop

Request from the clients asking for echo service. This request should include the client number and some data (your choide-string, number, etc). The server should identify the client number and return the data to the corresponding client using that clients specific FIFO and return to the top of the loop.

When the read request from the well-known FIFO returns 0 (which means all the clients have terminated and are no longer connected to the well-known FIFO), the server should close all the FIFOS and exit.

Client Program:

The client program will connect to the server through the well known FIFO and send requests through it to the server, more specifically, the client program should:

Acquire from the user (through the command line or reading from the keyboard) what the client number this instance of the program will be (i.e., client 1, client 2, etc.)

Create the client-specific FIFO using an appropriate name (i.e., ClientNfifo, where N is the client number).

Send to the server the first request (writing to the well-known FIFO) including the client number and the name of the client-specific FIFO so the server can open it)

Open the client-specific FIFO in READ mode to be able to read replies from the server.

Go into a loop where the client will ask the user what to do next providing two choices:

1 Send request to server, in this case it will ask the user for data to send, read it from the keyboard and send the client number and data to the server, then read the reply from the server in the client-specific FIFO and write it to the screen (i.e., Reply from server: XXXXXXX where XXXXXXX is the data received from the server.

2 Quit, in this case the client should close both FIFOs and exit

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

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago