Techniques to detect and handle data corruption during transmission.
Data transmitted over a network can be corrupted by noise or other interference, causing bits to flip (a 0 becomes a 1, or vice versa). The Data Link Layer is responsible for detecting these errors. Error detection techniques involve the sender adding some redundant information to the data, which the receiver can then use to check for errors. A simple method is the Parity Check, where an extra bit (the parity bit) is added to a block of data to make the total number of 1s either even (even parity) or odd (odd parity). The receiver checks the parity of the received data; if it doesn't match, an error is detected. However, parity can't detect an even number of bit errors. A much more powerful and commonly used technique is the Cyclic Redundancy Check (CRC). In CRC, the sender performs a polynomial division on the data bits and appends the remainder to the data as a checksum. The receiver performs the same division. If the remainder is zero, the data is considered error-free. CRC is very effective at detecting common types of burst errors. Once an error is detected, the frame is typically just discarded. The higher-level protocols (like TCP) are then responsible for retransmitting the lost data. Some more advanced codes, known as Forward Error Correction (FEC) codes (e.g., Hamming codes), not only detect errors but also contain enough redundant information to correct a certain number of them without needing retransmission, which is useful in real-time applications where latency is critical.