Error Checking (1.5.e)
When data is being transmitted, it can become corrupted. Therefore, data needs to be checked at the receiving end to ensure it is the same as the data that was transmitted before it is accepted.
Parity checking is where an 8-bit byte consists of 7 data bits, and 1 parity bit. There are two types of parity, odd parity and even parity. The type of parity used is agreed in advance according to the protocol. With odd parity, the total number of 1s will be odd. With even parity, the total number of 1s will be even.
If the total number of 1s is odd, but even parity is used, then the parity bit will be a 1, so that the total number of 1s that are transmitted in the byte is even. Therefore, if odd parity is used, but the total number of 1s is even, then the receiving computer knows there has been an error and asks for the data to be resent. Odd parity works in exactly the same way, but the total number of 1s will be odd, and not even.
Echos are a good way to check small amounts of data for errors. The data is returned to the sender, and the sender confirms it matches what was sent. However, this is slow and hugely inefficient, as the data is sent twice (to the receiver and back to the sender).
Data is sent in blocks of several bytes. The bytes are then added up (discarding any carry), and the result is transmitted with the data. When the data arrives, the receiver also independently completes a checksum. If the two checksums match, then the data is accepted.