Question: For this task, you'll be crafting both a client and a server in c + + . The aim is to enhance your ability to

For this task, you'll be crafting both a client and a server in c++. The aim is to enhance your ability to write compatible code. Specifically, you're building a client/server system for managing and analyzing test grades. Here's how the protocol operates:
The client connects to the server via TCP/IP on port 8001. Security concerns are disregarded for this exercise.
Upon connection, the server sends the message "COURSEID" to the client.
The client responds with a packet containing:
A four-character string denoting the course subject area.
A sixteen-bit signed integer (1003-9993) for the course number.
A sixteen-bit signed integer (0-99) for the section number.
Upon receiving this, the server replies with "MAX SCORE".
The client then sends a packet containing:
A sixteen-bit signed integer representing the maximum possible test score.
The server acknowledges with "BEGIN".
Subsequently, the client transmits test scores, one per packet, in this format:
A signed 32-bit integer for the student's ID (ranging from 100000-999999).
A signed 16-bit integer for the test score.
The client continues until it completes, using -1 as both student ID and test score, and then waits for the server's response.
The server replies with a packet containing:
Client's IP address (32-bit integer).
Client's Port number (16-bit integer).
Course information (11-character ASCII string).
Number of total scores received (excluding sentinel value -1).
Number of valid scores received.
Lowest score.
Highest score.
Average score (32-bit floating point).
Standard deviation (32-bit floating point).
The client then sends "ERRORS".
The server responds with "ERRORS", followed by packets indicating erroneous student IDs and test scores.
Finally, the server sends a packet with -1 as both student ID and test score to indicate completion, and closes the connection.
The server ensures results are printed for each client separately, preventing data overlap. It also prints client IP and port before handling, and result info before transmitting.
The client reads data from a file, where:
The first line contains course details.
The second line has the maximum possible score.
Subsequent lines list student IDs and their respective test scores.
The client sends scores individually with a random 1-3 second delay between packets.
The client sends -1-1 as sentinel values when done.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!