Error-Free Communication: How the Data Link Layer Ensures Reliable Data Transfer

Till now we have studied about MAC addressing, Framing and Random access concepts in Data link layer. In this blog we will Explore more about how the DLL Handle errors in the transmission of data and flow control. so Let’s start:

Flow control…


This content originally appeared on DEV Community and was authored by Aayush Singh

Till now we have studied about MAC addressing, Framing and Random access concepts in Data link layer. In this blog we will Explore more about how the DLL Handle errors in the transmission of data and flow control. so Let's start:

Flow control

Flow control is a technique to prevent the data overflow, the receiver has buffer memory where the incoming data are temporarily stored until processed, and the data processing speed often lags behind the transmission rate.

Flow control can be basically divided in two types:

  • Stop-and-Wait Flow Control: In this the sender divides data in frames sends one frame(and keep its copy) and wait a particular time(starts a timer) to receive an acknowledgment to send other frame, if the acknowledgment is not received due to any reason in a particular time the sender will resend the frame and again starts the timer. If the acknowledgment is arrived it will discard the frame and sends the other frame. In this method, only one of frames can be in transmission at a time. It leads to inefficiency. see the below diagram to get better understanding.

stop and wait

Lets discuss the diagram:

  • first frame 0 is send (timer is start), the receiver received it successfully and sends the acknowledgment for transmitting the frame-1.
  • The sender received the ack 1 successfully and send frame-1 (starts a timer), due to some issue this frame1 is lost, sender will not get any ack after a particular time timer stops ,resend the frame1 and again restarts the timer.
  • frame1 is successfully arrived and ack 0 is successfully received by sender. Sender sends Frame 0 it is received by receiver but this time the ack 1 get lost. so, the sender does not receive the ack 1 so it resends the frame 0. and this goes on. I hope from the above explanation you got the concept of stop and wait. But before proceeding to another flow control time, let us discuss about some delays to get a better understanding about delays.

Delay
You can classify delay in 4 types:
1.Propagration Delay: This is time it takes for a bit to travel from point A to point B in transmission media.(denoted by Tp)

Tp = (Distance) / (propagation speed)

2.Transmission Delay: A sender needs to put the bits in a packet on the line one by one. If the first bit of the packet is put on the line at time t1 and the last bit is put on the line at time t2, transmission delay of the packet is (t2-t1). (denoted by TT)

TT = (packet length) / Transmission rate or Bandwidth

3.Queuing Delay - It is measured as time a packet waits in the input queue and output queue of a router.

queue delay = The time a packet waits in input and output queues in a router

4.Processing Delay - It is a time require for a Destination host to receive a packet from its input port, remove the header,perform an error detection procedure, and deliver the packet to the output port or deliver the packet to the upper-layer protocol(in case of destination host).

Delay = Time require to process a packet in a destination host.

As you know the frames are send one by one in stop-and-wait. It is an inefficient method to transfer frame the more efficient method is Sliding Window flow control. In this multiple frames can be sent before waiting for acknowledgment.

sliding window

  • Sliding Window Protocol: Sliding Window allows a sender to transmit several frames consecutively, reducing idle time and improving network efficiency. The "window" refers to the number of frames that can be sent before the sender must pause and wait for acknowledgment. sliding window In this example just think window length 15(0-14). If all the 15 frames are send at once. If the sender receives acknowledgment of just say 6, It means all the frames before 6 have definitely been received so it will discard 0-5 and move the window forward to send more.

This protocol operates in two main variants: Go-Back-N ARQ and Selective Repeat ARQ.

1.Go-Back-N Automatic Repeat Request
Go-Back-N Automatic Repeat Request (ARQ) is a sliding window protocol used for reliable data transmission.In this method, the sender can transmit up to N frames (as defined by the window size) before needing an acknowledgment. However, if an error or packet loss occurs, the receiver rejects the erroneous frame and all subsequent frames, forcing the sender to go back and retransmit from the errored frame onward—even if some frames were received correctly.

For example, if a sender transmits frames 1 to 5 and an error occurs in frame 3, the receiver discards frames 3, 4, and 5 and requests retransmission starting from frame 3. This makes Go-Back-N simple to implement but can be inefficient in high-latency networks, as it wastes bandwidth by resending correctly received frames. Despite its inefficiency, it remains widely used in protocols like TCP (with certain modifications) due to its simplicity and robustness.

Go back n

The send window,an imaginary concept, covers the sequence numbers of frames that can be in transit, having maximum size of 2^m - 1.

Sequence numbers are divided into four regions: the first represents acknowledged frames(no copies kept), the second represents frames sent but with unknown status(outstanding farmes), the third denotes frames ready to be sent pending data packets from the network layer, and the fourth signifies sequence numbers inaccessible until the window slides further.

2.Selective Repeat ARQ : Selective Repeat Automatic Repeat Request (ARQ) is a more efficient sliding window protocol designed to minimize unnecessary retransmissions. Unlike Go-Back-N ARQ, where all frames after an erroneous one are discarded and resent, Selective Repeat only retransmits the corrupted or lost frames, saving bandwidth and improving network efficiency.

In this method, both the sender and receiver maintain separate sliding windows. The receiver stores correctly received frames in a buffer, even if they arrive out of order, and requests retransmission only for the missing or corrupted frames(Negetaive acknowledgment). Once all expected frames are received in order, the data is passed to the upper layer.

For example, if the sender transmits frames 1 to 5, and only frame 3 is lost or corrupted, the receiver will acknowledge frames 1, 2, 4, and 5 and request only frame 3 to be resent. This prevents redundant retransmissions, making Selective Repeat ARQ more bandwidth-efficient than Go-Back-N, especially in networks with high error rates. However, it requires more complex buffering and processing at both sender and receiver, making its implementation more resource-intensive. It is commonly used in high-speed and wireless networks where minimizing retransmissions is crucial.

Error Detection and correction

Understanding Errors in Data Transmission

In any communication system, data transmission errors are inevitable due to various physical and environmental factors. Whether you're sending a text message, streaming a video, or making an online transaction, data must travel through wired or wireless networks, and during this journey, it can get corrupted. Ensuring data accuracy and reliability is crucial, which is why networking protocols implement error detection and correction mechanisms.

What Are Errors in Networking?

An error occurs when the data received at the destination differs from the data sent by the source. These errors are usually caused by: Electromagnetic interference, Noise in transmission mediums, Signal attenuation, Synchronization issues.

Even a single bit error can cause major problems. For example, if a bank transaction of ₹5000 gets altered to ₹9000 due to an error, the consequences can be severe. This is why detecting and correcting errors is a fundamental part of networking.

Types of Errors:

Errors in data transmission are classified into two main types:

  • Single-Bit Errors A single bit is flipped (0 → 1 or 1 → 0) due to noise or interference. Rare in wired networks but more common in wireless communication.

Example:
Sent: 1011001
Received: 1011101 (4th bit flipped)

  • Burst Errors Multiple bits are altered in a sequence. More common in wireless and long-distance wired networks.

Example:
Sent: 1101010110
Received: 1100000110 (4-bit burst error)

Since errors cannot always be avoided, networks use error detection and correction techniques to identify and fix corrupted data before it causes failures.

This sets the foundation for understanding how error detection and correction techniques work, ensuring data integrity and reliable communication across networks.

Error Detection and Correction Techniques

  1. Parity Check (Single and Two-Dimensional Parity)
  • Single Parity Check (Even and Odd Parity): Parity checking is one of the simplest error detection methods, where an extra bit, called the parity bit, is added to a data unit (byte, word, or frame). The purpose of the parity bit is to ensure that the total number of 1s is either even or odd, depending on the chosen scheme.

Single Parity Check

Even Parity: The number of 1s in the data, including the parity bit, must be even.
Odd Parity: The number of 1s in the data, including the parity bit, must be odd.

Example of Even Parity:
If we want to send the 4-bit data "1010", we add a parity bit to ensure an even number of 1s.

Data Bits Parity Bit (Even) Transmitted Bits
1010 0 10100
1101 1 11011

At the receiver end: If an error occurs and the number of 1s becomes odd, it signals that the data is corrupted.

Limitations:

  • Cannot detect even-numbered bit errors (e.g., two bits flipped won’t change parity).
  • Does not correct errors, only detects them.

  • Two-Dimensional Parity Check : To improve error detection, a two-dimensional parity check extends parity checking across multiple data units (rows and columns).

Two-Dimensional Parity Check
How It Works:

  • A parity bit is added to each row of data (horizontal parity).
  • Another parity bit is added for each column (vertical parity).
  • The receiver checks both row and column parity to identify errors.

2.Checksum

The Checksum method is used in network protocols like TCP/IP to detect errors in transmitted data. Instead of checking individual bits, the checksum verifies an entire block of data by computing a sum of its values.

How It Works:

  • The sender divides data into equal-sized segments (e.g., 16-bit words).
  • It calculates the sum of all segments and sends the sum (checksum) along with the data.
  • The receiver performs the same sum calculation and compares it with the transmitted checksum.
  • If they match → Data is correct.
  • If they don’t match → An error is detected.

Example:
Assume we are transmitting two 16-bit data words:

Data 1 Data 2 Checksum (Sum of Data)
10011001 10101010 11001100 11110000 01100110 10100010

If any bit in the data gets corrupted, the receiver's sum will not match the transmitted checksum, signaling an error.

Limitations:

  • Cannot detect some burst errors, especially if errors cancel each other out.
  • Does not correct errors, only detects them.

3.Cyclic Redundancy Check (CRC)
Cyclic Redundancy Check (CRC) is a powerful error detection technique used in network protocols like Ethernet and Wi-Fi. It is based on binary division and is more reliable than parity and checksum methods.

CRC

How CRC Works:

  • The sender treats the data as a long binary number.
  • It divides this number by a predetermined divisor (generator polynomial) using modulo-2 division (binary division without carry).
  • The remainder of this division is the CRC code, which is appended to the data before transmission. Encoader
  • The receiver performs the same division and checks the remainder:
    • If the remainder is zero → No error detected.
    • If the remainder is non-zero → Error detected.

Example (Simplified CRC Calculation):

  • Suppose the data to be sent is 101100 and the divisor (generator) is 1101.
  • The sender appends zeros (one less than the divisor length) → 101100000.
  • The sender divides 101100000 ÷ 1101 (using XOR operations).
  • The remainder (CRC code) is 011, which is appended to the original data.
    Data CRC code Transmitted Data
    101100 011 101100011
  • The receiver divides 101100011 ÷ 1101:
    • If remainder = 0 → No error.
    • If remainder ≠ 0 → Error detected. Advantages of CRC:
  • Can detect multiple-bit errors (unlike parity and checksum).
  • Used in high-speed networks like Ethernet.
  • Efficient for large data blocks.

Limitations:

  • Cannot correct errors, only detects them.
  • Complex compared to parity and checksum methods.

Conclusion

In computer networks, ensuring reliable communication is a combination of error control and flow control. Error control mechanisms like Parity Check, Checksum, and CRC help detect corrupted data, while advanced techniques like ARQ (Automatic Repeat reQuest) ensure lost or erroneous packets are retransmitted. On the other hand, flow control mechanisms like Stop-and-Wait, Sliding Window, and Selective Repeat help regulate data transmission so that a fast sender does not overwhelm a slow receiver. Together, these techniques ensure data integrity and efficient transmission across networks.

Thanks for reading till here! I hope this blog helped you understand error detection, correction, and flow control in the Data Link Layer. In the next blog, we will dive into the Network Layer, where we’ll explore IP addressing, routing, and more. Stay tuned! 🚀 Follow me on Twitter and LinkedIn for more updates.


This content originally appeared on DEV Community and was authored by Aayush Singh


Print Share Comment Cite Upload Translate Updates
APA

Aayush Singh | Sciencx (2025-02-23T17:08:51+00:00) Error-Free Communication: How the Data Link Layer Ensures Reliable Data Transfer. Retrieved from https://www.scien.cx/2025/02/23/error-free-communication-how-the-data-link-layer-ensures-reliable-data-transfer/

MLA
" » Error-Free Communication: How the Data Link Layer Ensures Reliable Data Transfer." Aayush Singh | Sciencx - Sunday February 23, 2025, https://www.scien.cx/2025/02/23/error-free-communication-how-the-data-link-layer-ensures-reliable-data-transfer/
HARVARD
Aayush Singh | Sciencx Sunday February 23, 2025 » Error-Free Communication: How the Data Link Layer Ensures Reliable Data Transfer., viewed ,<https://www.scien.cx/2025/02/23/error-free-communication-how-the-data-link-layer-ensures-reliable-data-transfer/>
VANCOUVER
Aayush Singh | Sciencx - » Error-Free Communication: How the Data Link Layer Ensures Reliable Data Transfer. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/02/23/error-free-communication-how-the-data-link-layer-ensures-reliable-data-transfer/
CHICAGO
" » Error-Free Communication: How the Data Link Layer Ensures Reliable Data Transfer." Aayush Singh | Sciencx - Accessed . https://www.scien.cx/2025/02/23/error-free-communication-how-the-data-link-layer-ensures-reliable-data-transfer/
IEEE
" » Error-Free Communication: How the Data Link Layer Ensures Reliable Data Transfer." Aayush Singh | Sciencx [Online]. Available: https://www.scien.cx/2025/02/23/error-free-communication-how-the-data-link-layer-ensures-reliable-data-transfer/. [Accessed: ]
rf:citation
» Error-Free Communication: How the Data Link Layer Ensures Reliable Data Transfer | Aayush Singh | Sciencx | https://www.scien.cx/2025/02/23/error-free-communication-how-the-data-link-layer-ensures-reliable-data-transfer/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.