Starting from:

$40

NP Intro. to Network Programming Homework 2 - Bulletin Board System: Part 2 Solved

 Intro. to Network Programming
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 
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 
Success 
Create board successfully. 
Fail (1) 
Board already exist. 
Fail (2) 
Please login first. 
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. 

<tilte can have space but only in one line. <content can have space, and key in <br to indicate a new line. 
Success 
Create post successfully. 
Fail (1) 
Board does not exist. 
Fail (2) 
Please login first. 
list-board ##<key 
List all boards in BBS. 

<key is a keyword, use ## <key to do advanced query. 
Index      Name       Moderator 

<Index1   <Name1   <Moderator1 
list-post <board-name ##<key 
List all posts in a board named <board-name <key is a keyword, use ## <key to do advanced query. 
Success 
ID      Title       Author      Date 

<ID1   <Title1   <Author1   <Date1 
Fail 
Board does not exist. 
read <post-id 
Show the post which ID is <post-id. 
Success 
Author  :<Author1 

Title     :<Title1 

Date    :<Date1 

-- 

<content 

-- 

<User1 : <Comment1 
Fail 
Post does not exist. 
delete-post <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 
Delete successfully. 
Fail (1) 
Please login first. 
Fail (2) 
Post does not exist. 
Fail (3) 
Not the post owner. 
 

 

 

 

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!<brI have some problem! 

Board does not exist. 

% create-post NP_HW --title About NP HW_2 --content Help!<brI have some problem! 

Create post successfully. 

% create-post NP_HW --title HW_3 --content Ask!<brIs 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!<brha!<brha! 

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 

 

More products