Description
Intro. to Network Programming
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 Description Result
create-board
If Board’s name is already used, show failed
message, otherwise it is success.
Must be logged in when creating board’s
name
Success Create board successfully.
Fail (1) Board already exist.
Fail (2) Please login first.
create-post
–content
(command is in the same line )
Create a post which title is
is
Use –title and –content to separate titles and
content.
to
indicate a new line.
Success Create post successfully.
Fail (1) Board does not exist.
Fail (2) Please login first.
list-board ##
advanced query.
Index Name Moderator
list-post
advanced query.
Success
ID Title Author Date
Fail Board does not exist.
read
Title :
Date :
—
—
Fail Post does not exist.
delete-post
Only the post owner can delete the post.
If the user is not the post owner, show failed
message, otherwise it is success.
Success Delete successfully.
Fail (1) Please login first.
Fail (2) Post does not exist.
Fail (3) Not the post owner.
update-post
Update the post which ID is
Use — to decide which to modify, title or
content, and replaced by
Only the post owner can update the post.
If the user is not the post owner, show failed
message, otherwise it is success.
Success Update successfully.
Fail (1) Please login first.
Fail (2) Post does not exist.
Fail (3) Not the post owner.
comment
which ID is
Fail (1) Please login first.
Fail (2) Post does not exist.
exit Close connection.
Scenario
bash$ telnet 127.0.0.1 7890
********************************
** Welcome to the BBS server. **
% create-board 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 Moderator
1 NP_HW Bob
2 OS_HW Bob
3 FF_HW Bob
% list-board ##HW
Index Name Moderator
1 NP_HW Bob
2 OS_HW Bob
% create-post NCTU –title About NP HW_2 –content Help!
I have some problem!
Board does not exist.
% create-post NP_HW –title About NP HW_2 –content Help!
I have some problem!
Create post successfully.
% create-post NP_HW –title HW_3 –content Ask!
Is NP HW_3 Released?
Create post successfully.
% 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.
% update-post 1 –content Ha!
ha!
ha!
Not the post owner.
% delete-post 1
Not the post owner.
% comment 888 Ha! ha! ha!
Post does not exist.
% comment 1 Ha! ha! ha!
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
Index Name Moderator
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
Grade (100%)
⚫ create-board command. – (10%)
⚫ create-post command. – (20%)
⚫ list-board command. – (15%)
⚫ list-post command. – (15%)
⚫ read command. – (10%)
⚫ delete-post command. – (10%)
⚫ update-post command. – (10%)
⚫ comment command. – (10%)
Submission
Please upload a zip file called “hw2_{$student_id}.zip” that includes your source code. Submission that don’t follow the rule
will get 20% punishment on the grade.
You will get 0 points on this project for plagiarism. Please don’t copy-paste any code!
Note
You will be asked to use AWS resources in projects 3 and 4, so we suggest you use AWS SDK supported languages to
implement this project.
Reference
1. C/C++ Socket
2. SQLite C/C++ Interface
3. Linux socket SELECT
4. AWS SDK supported languages