When sending data over a network there is a possibility of interference and therefore errors occurring in the data. Here are two methods of detecting errors (and therefore correcting those errors). If an error is detected the TCP protocol requests the whole packet to be resent, or the transmission fails.
Parity Bit
A parity bit is an additional bit to indicate an odd or even number of 1’s in a sequence of bits. In a byte (8 bits) the last bit is used as a parity bit. For example in 1011100 there is an even number of 1’s, therefore a 0 is appended and 10111000 would be transmitted. If there is an odd number of 1’s a 1 would be appended (example 1001100 would be 10011001). The examples above demonstrate even parity as it creates an even number of 1’s, odd parity creates an odd number of 1’s. Protocols will determine (agree) what type of parity is used.
The downside to this method is if the interference results in multiple bits changing it may not identify that as an error. This method is very fast to check and is not processor intensive.
Checksum
Checksums perform a mathematical calculation on a number and the result is included as part of the transmission of data (packet). If any bit changes during transmission it results in the checksum not correlating at the destination when the calculation is run again. This method is more reliable than just using a parity check, but it is more processor intensive.