0% found this document useful (0 votes)
5 views

CN batch 03

The document discusses error detection and correction techniques in computer networks, focusing on Binary Convolutional Codes and Reed-Solomon Codes. It explains the significance of Hamming Code for single-bit error correction and provides a solution for determining the number of check bits needed for a 16-bit message. The conclusion emphasizes the importance of these techniques for reliable data transmission.

Uploaded by

myidsrilakshmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

CN batch 03

The document discusses error detection and correction techniques in computer networks, focusing on Binary Convolutional Codes and Reed-Solomon Codes. It explains the significance of Hamming Code for single-bit error correction and provides a solution for determining the number of check bits needed for a 16-bit message. The conclusion emphasizes the importance of these techniques for reliable data transmission.

Uploaded by

myidsrilakshmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Dept of CA

Computer Network
2nd BCA
Batch-03
Submitted by
Alisha(231FJ01013)
Srilakshmi(231FJ01018)
Komala(231FJ01035)
Yamini(231FJ01057)
ABSTRACT
Error detection and correction play a crucial role in ensuring data integrity during communication over computer
networks. Various techniques, such as parity checks, cyclic redundancy checks, and Hamming codes, help detect and
rectify errors. This document explores fundamental concepts of error detection and correction, focusing on Binary
Convolutional Codes and Reed-Solomon Codes, which are widely used in digital communication. Additionally, it
provides an in-depth solution for determining the number of check bits required for a 16-bit message transmitted using
Hamming Code with even parity, along with the corresponding bit pattern.
INTRODUCTION
In computer networks, transmitted data can be affected by noise, leading to errors in the received data. Error detection
and correction techniques are implemented to identify and rectify such errors, ensuring reliable communication. Error
detection methods allow the receiver to identify corrupted data, whereas error correction mechanisms enable
automatic error recovery without retransmission.
Among the various coding techniques, Binary Convolutional Codes and Reed-Solomon Codes are extensively used in
digital communication systems, such as wireless networks and data storage. Binary Convolutional Codes work by
encoding data streams into redundant sequences for error resilience, while Reed-Solomon Codes are effective in
correcting burst errors.
Furthermore, the Hamming Code is an essential error-correcting technique that allows for the detection and correction
of single-bit errors in data transmission.
PART-A:
a) What is error detection and correction in computer networks?
b) Discuss about binary convolutional code and reed Solomon code.
c) Sixteen-bit messages are transmitted using a Hamming code. How many check bits are needed to ensure that
the receiver can detect and correct single-bit errors? Show the bit pattern transmitted for the message
1101001100110101.Assume that even parity is used in the Hamming code.
ANSWER:
a)
Error Detection:
 The latter uses error-detecting codes.
 On channels that are highly reliable, such as fiber, it is cheaper to use an error-detecting code and just
retransmit the occasional block found to be faulty.
 Error detecting codes are all linear, systematic block codes.
 Error-detecting codes are commonly used in link, network, and transport layers.
Error-detecting codes-
1. Parity
2. Checksums
3. Cyclic Redundancy Checks (CRCs)
Error Correction:
 The use of error-correcting codes is often referred to as FEC (Forward Error Correction).
 The former strategy uses error-correcting codes
 Error-correcting codes are widely used on wireless links, which are notoriously noisy and error prone when
compared to optical fibers.
 FEC is used on noisy channels
 Error-correcting codes are also seen in the physical layer, particularly for noisy channels, and in higher layers,
particularly for real-time media and content distribution
Error-correcting codes-
1. Hamming codes.
2. Binary convolutional codes.
3. Reed-Solomon codes.
4. Low-Density Parity Check codes
b)
Binary convolutional code:
 This code is the only one we will cover that is not a block code. In a convolutional code, an encoder processes
a sequence of input bits and generates a sequence of output bits.
 There is no natural message size or encoding boundary as in a block code. The output depends on the current
and previous input bits. That is, the encoder has memory.
 The number of previous bits on which the output depends is called the constraint length of the code.
 Convolutional codes are specified in terms of their rate and constraint length.
 Convolutional codes are effective at handling isolated bit errors, but they will fail, likely with a burst of errors,
if there are too many errors in the received bit stream.
 Convolutional codes are widely used in deployed networks, for example, as part of the GSM mobile phone
system, in satellite communications, and in 802.11.
Reed-Solomon code:
 Reed-Solomon codes are linear block codes, and they are often systematic too.
 Unlike Hamming codes, which operate on individual bits, Reed-Solomon codes operate on m bit symbols.
 Reed-Solomon codes are actually defined as polynomials that operate over finite fields, but they work in a
similar manner.
 Reed-Solomon codes are widely used in practice because of their strong error-correction properties,
particularly for burst errors.
 They are used for DSL, data over cable, satellite communications, and perhaps most ubiquitously on CDs,
DVDs, and Blu-ray discs.
 By adding a Reed-Solomon code within the convolutional code, the Reed-Solomon decoding can mop up the
error bursts, a task at which it is very good. The overall code then provides good protection against both single
and burst errors.
c)
Code:
#include <stdio.h>
#include <string.h>
#include <math.h>
int calculate_parity_bits(int m) {
int r = 0;
while ((1 << r) < (m + r + 1)) {
r++;
}
return r;
}
void insert_parity_bits(char data_bits[], int m, int r, char encoded_data[]) {
int j = 0, k = 0;
for (int i = 1; i <= m + r; i++) {
if (i == (1 << j)) {
encoded_data[i - 1] = '0';
j++;
} else {
encoded_data[i - 1] = data_bits[k++];
}
}
}
void set_parity_bits(char encoded_data[], int n, int r) {
for (int i = 0; i < r; i++) {
int parity_pos = 1 << i;
int parity = 0;
for (int j = 1; j <= n; j++) {
if (j & parity_pos) {
parity ^= (encoded_data[j - 1] - '0');
}
}
encoded_data[parity_pos - 1] = parity + '0';
}
}
void encode_hamming(char data_bits[], char encoded_data[]) {
int m = strlen(data_bits);
int r = calculate_parity_bits(m);
printf("Number of parity bits (redundant bits) required: %d\n", r);
insert_parity_bits(data_bits, m, r, encoded_data);
set_parity_bits(encoded_data, m + r, r);
}
void decode_hamming(char encoded_data[], char decoded_data[]) {
int n = strlen(encoded_data);
int r = calculate_parity_bits(n);
int error_pos = 0;
for (int i = 0; i < r; i++) {
int parity_pos = 1 << i;
int parity = 0;
for (int j = 1; j <= n; j++) {
if (j & parity_pos) {
parity ^= (encoded_data[j - 1] - '0');
}
}
if (parity != 0) {
error_pos += parity_pos;
}
}
if (error_pos) {
printf("Error detected at position %d (from the left).\n", error_pos);
encoded_data[error_pos - 1] = (encoded_data[error_pos - 1] == '0') ? '1' : '0';
printf("Corrected encoded data: %s\n", encoded_data);
} else {
printf("No error detected based on even parity.\n");
}
int j = 0;
for (int i = 1; i <= n; i++) {
if (i != (1 << j)) {
decoded_data[i - j - 1] = encoded_data[i - 1];
} else {
j++;
}
}
decoded_data[n - r] = '\0';
}
int main() {
char data_bits[50], encoded_data[100], received_data[100], decoded_data[50];
printf("Enter the data to encode (e.g., 1010101): ");
scanf("%s", data_bits);
printf("Original Data: %s\n", data_bits);
int m = strlen(data_bits);
int r = calculate_parity_bits(m);
encode_hamming(data_bits, encoded_data);
encoded_data[m + r] = '\0';
printf("Encoded Data with Hamming Code: %s\n", encoded_data);
printf("Enter received data with error (e.g., 11010101): ");
scanf("%s", received_data);
decode_hamming(received_data, decoded_data);
printf("Decoded Data after Correction: %s\n", decoded_data);
return 0;
}
Output:
(for no error)

(for single-bit error)


(for two bit error)

CONCLUSION:
Error detection and correction are crucial for reliable data transmission in computer networks. Binary
convolutional codes are effective for real-time streaming applications, while Reed-Solomon codes excel in
correcting burst errors. Hamming codes provide single-bit error detection and correction, making them suitable for
memory and data transmission systems. In the given example, 5 check bits are required for a 16-bit message,
ensuring error correction under even parity implemented by using c program code.

You might also like