NS

Computer Science : S2 : L3 : Error Detection Methods

Following data transmission there is a chance that the data has been corrupted or changed, this can lead to data being lost or changed and makes it unreliable. 


Errors can happen because : 

  • Interference or power surges 

  • Packet switching problem (Data gain or loss)

  • Skewing of data

  • Wear and tear on cables.


Parity checking is one method to check if data has been changed following data transmission. This method is based on the number of bits in a byte of data . In a parity check the first 7 bits of the byte are the data itself and the most significant bit is known as the parity bit. If the parity bit is 0 there is an even number of 1’s. If the parity bit is a 1 there is an odd number of 1’s.


Even 

0 = even (True)

1 = odd (Error)


Odd 

0= Odd (True)

1= Even(Error)


An echo check is when data is sent to another device then back to the sender. THe sending error checks for any errors. This isn't reliable as an error can occur when sending data back for checking .


A checksum is a simple method of error detection. Data is sent in blocks and an additional value known as the checksum is also sent at the end of the block of data. At the receiving end, the checksum is recalculated from the block of data received. 

This calculated value is then compared to the checksum transmitted. If they are the same value, then the data was transmitted without any errors, if the values are different, then a request is sent for the data to be retransmitted.

Checksum Algorithm

  • Add the bytes together = x

  • Divide the sum of bytes (x) by 256

  • Round down to the nearest whole number (y)

  • Multiply (y) by 256 = (z)

  • Calculate the difference x – z

= Checksum