Description
Continuing the first part, you are asking to implement boards and posts in the Bulletin Board System (BBS). The server should be multiprocessing / multithreading, and the following function will be connected by TCP. Your posts should maintain in the shared memory, that is, all operations related to posts should be done in shared memory, and other operations have no limitation.
Requirement
The service accepts the following commands and at least 10 clients:
When client enter command incompletely, that is, missing parameters, the server should show command format for client.
If command is in the right format, the first failure message will have the higher priority, for example of the “create-board” command, the user didn’t login, then the result should be “Please login first”.
| Command format | Description | Result | |
| create-board <name> | Create a board which named <name>.
<name> must be unique. If Board’s name is already used, show failed message, otherwise it is success. Must be logged in when creating board’s name. There is no limit to do the operation by shared memory or database. |
Success | Create board successfully. |
| Fail (1) | Please login first. | ||
| Fail (2) | Board already exists. | ||
| create-post <board-name> –title <title>
–content <content> (command is in the same line) |
Create a post which title is <title> and content is <content>.
Use –title and –content to separate titles and content. <title> can have space but only in one line. <content> can have space, and key in <br> to indicate a new line. Do the operation by shared memory. Assign a unique serial number to each post. The serial number will start from 1 and increase by creating post. |
Success | Create post successfully. |
| Fail (1) | Please login first. | ||
| Fail (2) | Board does not exist. |
Create post successfully.
% create-post NP_HW –title HW_3 –content Ask!<br>Is NP HW_3 Released?
Create post successfully.
% list-post NP
Board does not exist.
% list-post NP_HW
S/N Title Author Date
- About NP HW_2 Bob 10/26
- HW_3 Bob 10/26
% read 100
Post does not exist.
% read 1
Author: Bob
Title: About NP HW_2
Date: 10/26
—
Help!
I have some problem!
—
% update-post 100 –title NP HW_2 Post does not exist.
% update-post 1 –title NP HW_2 Update successfully.
% read 1
Author: Bob
Title: NP HW_2
Date: 10/26
—
Help!
I have some problem!
—
% logout
Bye, Bob.
% login Sam 654321 Welcome, Sam.
% update-post 1 –content Ha! ha! ha!
Not the post owner. % delete-post 1 Not the post owner.
% comment 100 Ha! ha! ha!
Post does not exist.
% comment 1 Ha! ha! ha!
Comment successfully.
% read 1
Author: Bob
Title: NP HW_2
Date: 10/26
—
Help!
I have some problem!
—
Sam: Ha! ha! ha!
% create-board Hello
Create board successfully.
% list-board
Index Name Moderator




