What is CRC?
CRC or Cyclic Redundancy Check is a method of detecting accidental changes/errors in the communication channel.
CRC uses Generator Polynomial which is available on both sender and receiver sides. An example generator polynomial is of the form like x^3 + 1. This generator polynomial represents key 1001. Another example is x^2 + x. that represents key 110.
Let data send is “EVN”
We convert a string to binary string data.
CRC KEY: 1001
Code: CRC key length -1 -> 000 appended at end of data.
New data: 100010110101101001110000 Key:1001
Now we apply CRC in socket programming python at both sender and receiver side.
1. The task is to send a string data to the server/receiver side.
2. The sender sends a string let us say “EVN”.
3. First, this string is converted to binary string “100010110101101001110” key is known to both the side sender and receiver here key used is 1001.
4. This data is encoded using the CRC code using the key in the client/sender side.
5. This encoded data is sent to the receiver.
6. Receiver later decodes the encoded data string to verify whether there was any error or not.
1. The receiver receives the encoded data string from the sender.
2. Receiver with the help of the key decodes the data and find out the remainder.
3. If the remainder is zero then it means there no error in data sent by the sender to receiver.
4. If the remainder comes out to be non-zero it means there was an error, a Negative Acknowledgement is sent to the sender. The sender then resends the data until the receiver receives correct data.
How to run the program:
1. You should have socket programming library.
2. First, run server program then run client program.
3. Indentation error may occur while you copy paste the code so be careful while copying.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Vertical Redundancy Check (VRC) or Parity Check
- Longitudinal Redundancy Check (LRC)/2-D Parity Check
- Hot Standby Router Protocol (HSRP) and Virtual Router Redundancy Protocol (VRRP)
- Introduction of Virtual Router Redundancy Protocol (VRRP) and its configuration
- Python | Index specific cyclic iteration in list
- Python | Sum two unequal length lists in cyclic manner
- Python - Incremental and Cyclic Repetition of List Elements
- PyQt5 - Selecting any one check box among group of check boxes
- PyQt5 - Check box checked state depending upon another check box
- Python program to check if the list contains three consecutive common numbers in Python
- How to check if a string is a valid keyword in Python?
- Python program to check if a string is palindrome or not
- Python | Check if all the values in a list that are greater than a given value
- Python dictionary, set and counter to check if frequencies can become same
- Python sorted() to check if two strings are anagram or not
- Python | Check if a Substring is Present in a Given String
- Python set to check if string is panagram
- Python - Check if a list is empty or not
- Python program to check the validity of a Password
- Python | Check if two lists have at-least one element common
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : Akanksha_Rai