Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Question 1 Description You will implement a simple multi-process client-server system, which allows processes to share information via a server. Implement at least two

Python Question

1 Description

You will implement a simple multi-process client-server system, which allows processes to share information via a server.

Implement at least two client processes (say, Alice and Bob), and a server process. Your system should allow Alice to upload "key-value" pairs to the server so that Bob can retrieve them later.

For example, a key-value pair is of the form "username=foo", where the key is "username" and the value is "foo". Specifically, Alice (or rather, Alice's client) sends the string "STORE username=foo".

When Bob connects to the server, his client asks the server for the key by sending the server the "GET key" message. The server responds with the value associated with the key if there is any. If the server doesn't have the key, then it returns the string "ERROR" .

2 Implementation notes

You will need to launch at least three processes. These processes will have to be launched by a "driver program", say driver.py, that spawns all the processes required.

The Alice, Bob, and server processes need to be in separate files, say alice.py, bob.py, server.py. All four programs can take command-line arguments. For instance, you could invoke python alice.py --key=username --value=foo.

3 Testing

It is important that you provide multiple test cases for your system. Otherwise, we will have no way of evaluating your submission.

For instance, you should test multiple scenarios:

  1. Alice stores multiple keys
  2. Bob retrieves multiple keys
  3. Bob tries to retrieve a key not stored by the server

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

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions