This a project school that consist in a Introduction, Detection, and Error Correction on Content using CRC algorithm.
Given the following polynomial that we have chosen to use in our CRC algorithm:
(in binary: 0b10111001
)
We can determine that the hamming distance of this polynomial is 4, which means that we can detect up to 3 errors and correct up to 1 error.
The established architecture is capable of handling multiple clients by connecting to a proxy, which is in turn connected to a server, using the TCP protocol with multi-threading support.
To send a message, the client inserts a character and then calculates its CRC (Cyclic Redundancy Check), which is concatenated to form a 2-byte packet:
+-----------+-----------+
| Message | CRC |
| (1 byte) | (1 byte) |
+-----------+-----------+
The client then sends the packet to the proxy, which modifies random bits in the first byte representing the message.
Note: We assume that the byte representing the CRC cannot be altered.
The proxy then forwards the modified packet to the server, which verifies its validity by performing a polynomial division in the binary field
Two cases can occur:
- If the remainder of the polynomial division is zero, there are no errors.
- If the remainder is non-zero, an error is detected and can be corrected by comparison with a software register.
If the server fails to correct the error, it sends a predefined value of 0xFFFF
, indicating that the packet could not be corrected. The client then resends the packet until the server manages to correct the error.
In root directory:
make
you will need to execute in order:
./bin/project-rio --server --server-address=localhost --server-port=9876
./bin/project-rio --proxy --proxy-address=localhost --proxy-port=9800 --server-address=localhost--server-port=9876
./bin/project-rio --client --proxy-address=localhost --proxy-port=9800
Note: You can use the --help
flag to see the available options for each program.
- Ross N. Williams. : A painless guide to crc error detection algorithms
- Sunshine2K : Understanding and implementing CRC (Cyclic Redundancy Check) calculation
- Alexander Yanovskyy
- Roman Bonnet
- Jean-Raphäel Julien
- Romain Bourdain