| HowItWorksLab ¡ Simulators
English

TCP Packet Loss & Retransmission Simulator

TCP keeps data flowing even when the network drops packets. Set a loss rate and a timeout, then run the simulation to watch packets get lost, time out and be sent again until they arrive.

Sender Send queue Receiver Received Network (packets may drop)
Ready... click Start
What happens, in order Send → Drop? → Timeout → Resend → ACK
Display mode

Detailed Explanation

What is a packet loss simulator?

This simulator models how one reliable connection copes with an unreliable network. The sender hands over one data packet at a time, the network may quietly throw some away, and the receiver answers each packet that survives with a short acknowledgement, an ACK.

Because a sender cannot hear silence, it uses a timer. If no ACK comes back within the retransmission timeout, the packet is assumed lost and the same data is sent again — the heart of TCP's reliability.

Why tune it?

The two sliders are the two real trade-offs. The loss rate sets how hostile the network is, and the timeout sets how patient the sender is. A very short timeout recovers quickly but fires needlessly; a very long one wastes time before noticing a real loss.

Run the simulation at different settings and read the log: it shows every send, drop, timeout and ACK in order, so you can see how loss turns into delay.

Components & their role

1. The sender transmits a data packet

The sender takes the next packet from its send queue and puts it on the wire. Its sequence number is logged so every attempt can be told apart.

2. The network may drop it

Based on the loss rate you set, the packet either crosses the network or is lost. A loss is drawn as the packet turning red and stopping in the middle: it never reaches the receiver.

3. The sender waits for a timeout

No acknowledgement arrives for a lost packet, so the sender simply waits. After the retransmission timeout expires it concludes the packet was lost rather than merely slow.

4. The sender retransmits

The sender resends the same data with the same sequence number. This repeats as many times as needed: the receiver can recognise a duplicate and keep only one copy.

5. The receiver acknowledges

When a packet finally gets through, the receiver stores it, sends an ACK back and the sender moves on to the next sequence number. The stream stays complete even though individual packets were lost.

What does the packet loss rate mean?

It is the chance, from 0 to 100 percent, that any single packet is dropped by the network. At 20 percent roughly one in five packets never reaches the receiver and has to be sent again.

What is the retransmission timeout (RTO)?

It is how long the sender waits for an acknowledgement before assuming a packet was lost and sending it again. A short RTO reacts fast but may resend too eagerly; a long RTO wastes time before recovering.

Why is the same packet sent more than once?

If no acknowledgement arrives in time, the sender cannot tell a lost packet from a slow one, so it assumes the worst and retransmits. It keeps the same sequence number, so the receiver can spot a duplicate.

What is an ACK?

An ACK, short for acknowledgement, is the small reply the receiver sends back to confirm that it got a packet. Reaching the sender, it tells the sender that this packet is safe and the next one can go.

Does a dropped packet corrupt the data?

No. A dropped packet simply never arrives. The data is only at risk if a packet is corrupted in transit rather than lost, which is why TCP also carries checksums and drops damaged packets.

Is this exactly how real TCP works?

Not exactly. Real TCP pipelines many packets at once, uses sliding windows and adaptive timers. This model shows one packet at a time and a fixed timeout, so it is a teaching simplification.

Common Misconceptions

A lost packet corrupts the data. People think loss means the message arrives scrambled.
Loss just means it never arrives. A dropped packet is simply absent; the resend fills the gap.
The sender knows instantly that a packet was lost. The network tells the sender the moment a packet disappears.
The sender only knows from silence. With no reply, the only clue is that the timer ran out.
A shorter timeout is always better. Reacting fastest gives the quickest recovery.
Too short causes needless resends. The timeout must stay longer than a normal round trip, or it fires on packets that were never lost.
Retransmission changes the data. The resend carries new or partial information.
The resend is an identical copy. The same sequence number and payload go again, so the receiver keeps exactly one.
Disclaimer: Diagrams are heavily simplified for educational demonstration only. Real-world systems contain far more variables and complexity. Not for engineering production use. Not financial, political or professional advice.