Description
Homework 2 – Bulletin Board System: Part 2
Description
Continuing the first part, you are asking to implement the functions of the Bulletin Board System (BBS) server.
Requirement
The service accepts the following commands and at least 10 clients:
When client enter command incompletely E.g., missing parameters, the server should show command format for client.
Command format create-board <name>
create-post <board-name> –title <title> –content <content>
(command is in the same line )
list-post <board-name> ##<key>
read <post-id>
delete-post <post-id>
Description
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
Create a post which title is <title> and content is <content>.
Use –title and –content to separate titles and content.
<tilte> can have space but only in one line. <content> can have space, and key in <br> to indicate a new line.
List all posts in a board named <board-name> <key> is a keyword, use ## <key> to do advanced query.
Show the post which ID is <post-id>.
Delete the post which ID is <post-id>.
Only the post owner can delete the post.
If the user is not the post owner, show failed message, otherwise it is success.
Success Fail (1) Fail (2) Success
Fail (1) Fail (2)
Success
ID <ID1>
Fail
Fail Success Fail (1) Fail (2) Fail (3)
Result
Create board successfully.
Board already exist. Please login first.
Create post successfully.
Board does not exist. Please login first.
|
list-board ##<key> |
List all boards in BBS. |
Index Name Moderator <Index1> <Name1> <Moderator1> |
Title <Title1>
Author Date <Author1> <Date1>
Board does not exist.
Post does not exist. Delete successfully. Please login first. Post does not exist. Not the post owner.
|
Success |
Author :<Author1> Title :<Title1> Date :<Date1> — <content> |
update-post <post-id> –title/content <new>
comment <post-id> <comment>
exit
Scenario
Update the post which ID is <post-id>.
Use — to decide which to modify, title or content, and replaced by <new>.
Only the post owner can update the post.
If the user is not the post owner, show failed message, otherwise it is success.
Leave a comment < comment > at the post which ID is <post-id>
Close connection.
Success
Fail (1)
Fail (2)
Fail (3)
Success Fail (1) Fail (2)
Update successfully. Please login first. Post does not exist. Not the post owner.
Comment successfully. Please login first.
Post does not exist.
******************************** ** Welcome to the BBS server. **
bash$ telnet 127.0.0.1 7890
NP_HW
Please login first.
% register Bob bob@qwer.asdf 123456 Register successfully.
% register Sam sam@qwer.com 654321 Register successfully.
% login Bob 123456
Welcome, Bob.
% create-board NP_HW
Create board successfully.
% create-board NP_HW
Board already exist.
% create-board OS_HW
Create board successfully.
% create-board FF
Create board successfully.
% list-board
Index Name
- 1 NP_HW Bob
- 2 OS_HW Bob
- 3 FF_HW Bob
% list-board ##HW
Index Name
1 NP_HW Bob 2 OS_HW Bob
Moderator
Moderator
% create-board
% create-post NCTU –title About NP HW_2 –content Help!<br>I have some problem!
Board does not exist.
% create-post
Create post successfully.
% create-post
Create post successfully.
NP_HW
NP_HW
--title About NP HW_2 --content Help!<br>I have some problem!
--title HW_3 --content Ask!<br>Is NP HW_3 Released?
% list-post NP
Board does not exist. % list-post NP_HW
% list-post NP_HW ##HW_2
% read 888
Post does not exist. % read 1
Author :Bob
Title :About NP HW_2 Date :2020-03-31
—
Help!
I have some problem!
—
% update-post 888 –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 :2020-03-31 —
Help!
I have some problem!
--
% logout
Bye, Bob.
% login Sam 654321 Welcome, Sam.
1 –content
Not the post owner.
% delete-post 1 Not the post owner.
Post does not exist.
Comment successfully. % read 1
Author :Bob
Title :NP HW_2 Date :2020-03-31 —
Help!
I have some problem!
--
Sam: Ha! ha! ha!
% create-board Hello Create board successfully. % list-board
% update-post
|
% comment |
888 Ha! ha! ha! |
|
% comment |
1 Ha! ha! ha! |
Index Name
- 1 NP_HW Bob
- 2 OS_HW Bob
- 3 FF_HW Bob
- 4 Hello Sam
% logout
Bye, Sam.
% login Bob 123456 Welcome, Bob.
% delete-post 1 Delete successfully. % read 1
Post does not exist. % logout
Bye, Bob.
% exit
Ha!<br>ha!<br>ha!
Moderator




