Your solution to this assignment should be uploaded to Homework 5 on moodle by 11:55 PM on Wednesday, 18 March, 2015.
You can submit your program inside a ZIP archive, but there needs to be one executable file called home05 within the archive.
The task
Implement a server. You can use any programming language that creates an executable on Linux computer, but I suggest you use Python. Your program should be written so that it can be started by by executing the following command on a Linux computer.
[…]$ ./home05 port
Your program will create a port with the number given by the user and implement the protocol described below. If the user provides a port “number” that cannot be opened, your program should print an error message and terminate.
In testing your program, you may find it useful to print logging message.
The server
Your server will maintain a shared “database” of two values, a color and an animal. Assume the initial color is brown and the initial animal is bear.
The commands
After a connection is made the client will sends commands to the server and the server will reply. Let’s start with an example client-server interaction. The server will talk in red and the client will talk in blue.
?animal bear ?color brown animal=fox ?color brown color=red ?color red ?animal fox
There are two assignment commands, one for color and the other for animal. These change the appropriate value stored in the server.
There are two inquiry commands. These return values set in the server.
Your server can ignore improperly formatted input.
Concurrent operations
Your server should be able to accept and process several concurrent connections. When there are two active connections, the clients must be able to “see” modifications make by each other.
Turning in
Grading
Server programs are expected to be well-written and well-documented. They are also expected to be robust. In order to receive more than 75% credit for this assignment, your server must also be able to process concurrent client connections! In order to receive more than 50%, your server must demonstrate that it has been testing. In order to receive more than 25%, your server must be written in legal Python.