计算机网络代写|Project 1: A Simple KeyValue Service

这是一个美国的计算机网络代写作业案例分析

This project is designed to familiarize you with socket programming to implement simple network functions. You will develop a client program and a server program that communicate with each other using TCP sockets. The server process hosts a key value store that clients can interact with. Specific interactions include the following:
storing key/value pairs into the store, retrieving key/value pairs from the store, listing the key set and list the value set.

You can write your code in whatever language you choose, as long as your code compiles and runs on Linux machines1 on the command line. Do not use libraries that are not installed by default in Linux. Similarly, your code must compile and run on the command line. You may use IDEs (e.g. Eclipse) during development, but do not turn in your IDE project without a README file and/or a Makefile.
Make sure you code has no dependencies on your IDE.

A key-value store is essentially a database that maps keys to their corresponding values. In this project, you will implement a simplified key-value store. Each item in the key-value store has a key, which is the name of the item, and a value, which is the actual content of the item. A key-value store provides the following basic functions:

In addition to the above functions, the service also provides two auxiliary functions:
help and bye. The function help allows clients to list all the available functions provided by the server. The function bye terminates the client process.

The client program can interact with the server from command line interfaces. The server process should be started in the terminal first. For example:

python server.py

Throughout this instruction, Python is used for demonstration purpose. But specific commands may be different if you use a different language or different service names.

We can assume that this service is running on a fixed port number, e.g. 50000, that is known by the client. Then the client program should be invoked in another terminal window as follows.

python client.py

Upon starting, it prints a welcome message:

python client.py
Welcome to the KeyValue Service Client
Enter the IP address or Hostname of the server:

After this, the client program asks for the IP address or hostname of the server that user should type in. If the IP address or hostname is valid, the client should see the following messages:

python client.py
Welcome to the KeyValue Service Client
Enter the IP address or Hostname of the server: localhost
Please wait while I connect you…

Once a connection is established, the client should receive a welcoming message from the server and prints it on the screen. Meanwhile, a prompt will show up for the user to enter commands.

python client.py
Welcome to the KeyValue Service Client
Enter the IP address or Hostname of the server: localhost
Please wait while I connect you…
Welcome to the KeyValue Service
KeyValue Service>