Skip to content

The implementation of the server is based on the Thread-Per-Client (TPC) and Reactor server, written in Java. The client is written in C++. The communication between the server and the client(s) is based on binary communication protocol

Notifications You must be signed in to change notification settings

OmerNouri2/Course-Registration-System-Client-Server-socket-programming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Project name:

Course-registraion-system-Server-and-Client

Description:

implement a “Course Registration System” server and client. The implementation of the server is based on the Thread-Per-Client (TPC) and Reactor design pattern, written in Java. The client is written in C++. The communication between the server and the client(s) is based on binary communication protocol.

Establishing a client/server connection

Upon connecting, a client must identify himself to the service. A new client will issue a Register command with the requested user name and password. A registered client can then login using the Login command. Once the command is sent, the server will acknowledge the validity of the username and password. Once a user is logged in successfully, she can submit other commands.

Courses File

The data about the courses (for the server use) are given by a text file. The file name is Courses.txt. The file consists of lines, where every line refers to a specific course. The format of a single line will be as follows: courseNum|courseName|KdamCoursesList|numOfMaxStudents courseNum: the number of the course (100>= int >= 0) courseName: the course name (non-empty string) KdamCoursesList: the list of the Kdam courses. (format: [course1Num, course2Num,...]). numOfMaxStudents: the maximum number of students allowed to register to this course(int >= 5).

Supported Commands:

The protocol is composed of two types of commands, Server-to-Client and Client-to-Server. The commands begin with 2 bytes (short) to describe the opcode . The rest of the message will be defined specifically for each command as such: 2 bytes for the opcode | Length defined by command

Opcode : 1 | Operation: Admin register (ADMINREG) Opcode : 2 | Operation: Student register (STUDENTREG) Opcode : 3 | Operation: Login request (LOGIN) Opcode : 4 | Operation: Logout request (LOGOUT) Opcode : 5 | Operation: Register to course (COURSEREG) Opcode : 6 | Operation: Check Kdam course (KDAMCHECK) Opcode : 7 | Operation: (Admin)Print course status (COURSESTAT) Opcode : 8 | Operation: (Admin)Print student status (STUDENTSTAT) Opcode : 9 | Operation: check if registered (ISREGISTERED) Opcode : 10 | Operation: Unregister to course (UNREGISTER) Opcode : 11 | Operation: Check my current courses (MYCOURSES) Opcode : 12 | Operation: Acknowledgement (ACK) Opcode : 13 | Operation: Error (ERR)

Testing run commands:

Reactor server: mvn exec:java -Dexec.mainClass=”bgu.spl.net.impl.BGRSServer.ReactorMain” - Dexec.args=” ”

Thread per client server: mvn exec:java -Dexec.mainClass=”bgu.spl.net.impl.BGRSServer.TPCMain” - Dexec.args=””

Program Execution :

run the following commands:

tar -zxf #ID1_#ID2.tar.gz cd Client make cd ../Server mvn clean mvn compile Once this is done all the code should be compiled properly. Note: the terminal sesiion should be open for the server and more for each client.

About

The implementation of the server is based on the Thread-Per-Client (TPC) and Reactor server, written in Java. The client is written in C++. The communication between the server and the client(s) is based on binary communication protocol

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published