building board message and distribution Agreement in C/C++
This project consists of two phases.
In the first phase, you will construct a simple network server.
The next phase will consist of convincing multiple such servers to work together. Read the document completely before starting any coding; everything in the document is part of the specification and it is your
responsibility to ensure that you have implemented the whole server as specified.
The challenge is set up so that it gives you the opportunity to showcase your skills in system programming in a POSIX1
environment. Indeed, you must implement the server as a UNIX service (“daemon”) and
you further must use the POSIX API provided by the UNIX standard C library. Therefore your server must
be written in C or C++.
Throughout the handout, we will refer to the following configuration parameters. How these parameters
are obtained will be described in Section 3.1.
• bp is the port number for client-server communication (positive integer), see Section 1;
• sp is the port number for inter-server communication (positive integer), see Section 2;
• bbfile is the name of the bulletin board file that will be manipulated throughout this project (string),
see Section 1;
• Tmax is the number of preallocated threads (positive integer), see Section 1.4;
• peers the list of peers participating in synchronization (possibly empty list of pairs hostname–port
number), see Section 2;
• d is a Boolean flag controlling the startup of the server, see Section 1.5;
• D is a Boolean flag controlling debugging facilities, see Sections 1.3 (last paragraph) and 3.2.
Your first task is to construct a simple bulletin board server. The server accepts one-line messages from multiple clients, stores them in a local file, and serves them back on request. The name of the file is given by the parameter bb file. Messages are identified upon storage by a unique number established by the server, and by the “sender ” of the message (as provided by the USER command explained below).
The clients connect to our server on port bp. We also assume a production environment so that we implement concurrency control.
We are now ready to implement a replicated database management system. Since we have it already we will use the bulletin board file as our database. This file is now kept replicated (and synchronized) on multiple servers.
Each server receives a list of the other servers that are participating in the synchronization. This is the list of peers as specified in the configuration file and/or on the command line. Each element in the list consists of a hostname and a port number.
In addition, each server listens on port sp for incoming requests for synchronization.