$40
Intro. to Network Programming
Homework 1 - Bulletin Board System: Part 1
Description
In this project, you are asked to design Bulletin Board System (BBS) server. Your program should be able to handle multiple connections and receive user command from standard input. After receiving command, the server send the corresponding message back.
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.
General
Please make sure you develop your program on Linux. For development environment, you can just apply NCTU CSCC account to use Linux workstation. If you don’t want to apply anything, you can use VM for develop.
Use ‘’% “ as the command line prompt. Notice that there is only one space after the prompt.
The server close connection if client use exit command, but server still running and client can connect again.
For manage user information, storing data in your server is necessary. Therefore, you must have some methods to handle this, like manage a simple database e.g. SQLite and then design tables by yourself or only use data structure to store data.
To run your server, you must to provide port number for your program. E.g., bash$ ./server 7890
Now, you can use telnet or other client program to connect your server, when client connect to server, the server print message “New connection.”
Assume your server is running on localhost and listening at port 7890. E.g., bash$ telnet 127.0.0.1 7890
Scenario
bash$ telnet 127.0.0.1 7890
********************************
** Welcome to the BBS server. ** ********************************
% register
Usage: register <username <email <password
% register Bob bob@qwer.asdf 123456 Register successfully.
% register Bob asdf@asdf.asdf 123456
Username is already used.
% login
Usage: login <username <password
% login Bob
Usage: login <username <password
% login Bob 654321 Login failed.
% login Tom 654321 Login failed.
% login Bob 123456 Welcome, Bob.
% login Bob 123456
Please logout first.
% whoami
Bob
% logout
Bye, Bob.
% logout
Please login first. % whoami
Please login first.
% exit
Grade (100%)
⚫ Socket connection and print welcome message to client. - (30%)
⚫ register command. - (30%)
⚫ login / logout command. - (20%)
⚫ whoami command. - (10%)
⚫ exit command. - (10%)
Submission
Please upload a zip file called “hw1_{$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 im- plement this project.
Reference
1. C/C++ Socket
2. SQLite C/C++ Interface
3. Linux socket SELECT
4. Database table example
CREATE TABLE USERS(
UID INTEGER PRIMARY KEY AUTOINCREMENT,
Username TEXT NOT NULL UNIQUE,
Email TEXT NOT NULL,
Password TEXT NOT NULL
);
5. AWS SDK supported languages