Question: 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. 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

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!