💡 TCP connections begin with a SYN packet to synchronize sequence numbers.
setup
Server receives SYN and replies with SYN-ACK
The server receives the SYN, processes it, and replies with a SYN-ACK packet. The server's sequence number is 3000, and it acknowledges the client's SYN by setting ACK=1001.
💡 The server acknowledges the client's SYN and sends its own SYN to synchronize sequence numbers both ways.
💡 Sequence numbers track the byte offset of data sent for reliable delivery.
compare
Server receives data and sends ACK (ack=1006)
The server receives the data packet with seq=1001 and payload 'Hello' (5 bytes). It sends an ACK with ack=1006, indicating it expects the next byte at 1006.
💡 ACK numbers confirm receipt of data and indicate the next expected byte.
💡 Sequence numbers ensure data ordering and tracking of bytes sent.
prune
Second data packet lost in transit (no ACK received)
The second data packet is lost and does not reach the server. The client waits for an acknowledgment but none arrives before the retransmission timeout (RTO).
💡 Packet loss triggers retransmission mechanisms in TCP to ensure reliability.
Line:# Packet lost, no ACK received; wait for RTO
💡 TCP detects lost packets by missing ACKs and uses timers to trigger retransmission.
retransmit
Retransmission timeout (RTO) triggers resend of lost packet
The client's retransmission timer expires (RTO). It resends the lost data packet with seq=1006 and payload 'World'.
💡 Retransmission ensures lost data is resent to maintain reliable delivery.
💡 TCP uses timers to detect lost packets and trigger retransmission automatically.
compare
Server receives retransmitted packet and sends ACK (ack=1011)
The server receives the retransmitted packet with seq=1006 and payload 'World'. It sends an ACK with ack=1011, confirming receipt of all data up to byte 1010.
💡 ACK confirms cumulative receipt of data, including retransmitted packets.
Client receives final ACK confirming all data received
The client receives the ACK with ack=1011, confirming all sent data has been received by the server. The connection is now fully synchronized and data transfer is complete.
💡 Final ACK confirms reliable delivery of all data and allows the client to send more data or close connection.
Line:# Client processes final ACK
💡 TCP uses ACKs to confirm data delivery and maintain flow control.
TCP Sequence Numbers, ACKs & Retransmission (RTO) - Watch the Algorithm Execute, Step by Step
Watching this step-by-step visualization helps you understand how TCP manages sequence numbers and acknowledgments to guarantee data delivery, and how retransmission works when packets are lost or delayed.
Step 1/10
·Active fill★Answer cell
Client sends SYN to initiate connection and set initial sequence number
Hop: 1
Client
Server
📦Packet
↗ fromclient
↘ toserver
🔌 protocolTCP
🚩 flagsSYN
src→10.0.0.1:50000
dst→10.0.0.2:80
flags→SYN
SYN: client→server (seq=1000)
Server replies with SYN-ACK to acknowledge client's SYN and send its own sequence number
Hop: 2
Client
Server
📦Packet
↗ fromserver
↘ toclient
🔌 protocolTCP
🚩 flagsSYN, ACK
src→10.0.0.2:80
dst→10.0.0.1:50000
flags→SYN, ACK
SYN: client→server (seq=1000)
SYN-ACK: server→client (seq=3000, ack=1001)
Client sends ACK to complete handshake and confirm server's sequence number
Hop: 3
Client
Server
📦Packet
↗ fromclient
↘ toserver
🔌 protocolTCP
🚩 flagsACK
src→10.0.0.1:50000
dst→10.0.0.2:80
flags→ACK
SYN: client→server (seq=1000)
SYN-ACK: server→client (seq=3000, ack=1001)
ACK: client→server (seq=1001, ack=3001)
Client sends first data packet with sequence number 1001
Hop: 4
Client
Server
📦Packet
↗ fromclient
↘ toserver
📄 payloadHello
🔌 protocolTCP
🚩 flags
src→10.0.0.1:50000
dst→10.0.0.2:80
data→Hello
SYN-ACK: server→client (seq=3000, ack=1001)
ACK: client→server (seq=1001, ack=3001)
DATA: client→server (seq=1001, data='Hello')
Server acknowledges receipt of 5 bytes, expecting next byte 1006
Hop: 5
Client
Server
📦Packet
↗ fromserver
↘ toclient
🔌 protocolTCP
🚩 flagsACK
src→10.0.0.2:80
dst→10.0.0.1:50000
flags→ACK
ACK: client→server (seq=1001, ack=3001)
DATA: client→server (seq=1001, data='Hello')
ACK: server→client (seq=3001, ack=1006)
Client sends second data packet with sequence number 1006
Hop: 6
Client
Server
📦Packet
↗ fromclient
↘ toserver
📄 payloadWorld
🔌 protocolTCP
🚩 flags
src→10.0.0.1:50000
dst→10.0.0.2:80
data→World
DATA: client→server (seq=1001, data='Hello')
ACK: server→client (seq=3001, ack=1006)
DATA: client→server (seq=1006, data='World')
Second data packet lost; client waits for ACK but none arrives
Hop: 7
Client
Server
ACK: server→client (seq=3001, ack=1006)
DATA: client→server (seq=1006, data='World')
Packet lost: DATA seq=1006
Client retransmits lost packet after timeout (RTO)
✓ TCP uses sequence numbers and ACKs to track data sent and received, ensuring reliable delivery.
This insight is hard to see from code alone because sequence and ACK numbers are abstract counters; visualization shows their flow and updates clearly.
✓ Retransmission timeout (RTO) triggers resending lost packets automatically to recover from packet loss.
Plain English explanation: when an ACK is not received in time, TCP resends the missing data to guarantee delivery.
✓ The three-way handshake synchronizes sequence numbers between client and server before data transfer begins.
Seeing the SYN, SYN-ACK, and ACK packets in sequence clarifies how TCP establishes connection state.
Practice
(1/5)
1. Trace the sequence of DNS queries when a browser requests 'www.example.com' and the local DNS cache is empty. Which of the following correctly describes the order of servers queried?
easy
A. Local resolver -> Recursive DNS server -> Root DNS server -> TLD DNS server -> Authoritative DNS server
B. Local resolver -> TLD DNS server -> Root DNS server -> Recursive DNS server -> Authoritative DNS server
C. Local resolver -> Root DNS server -> Recursive DNS server -> TLD DNS server -> Authoritative DNS server
D. Local resolver -> Recursive DNS server -> Authoritative DNS server -> Root DNS server -> TLD DNS server
Solution
Step 1: Start at local resolver
The browser asks the local resolver, which forwards to the recursive DNS server if cache is empty.
Step 2: Recursive DNS server queries root server
The recursive server queries the root DNS server to find the TLD server for '.com'.
Step 3: Recursive server queries TLD server
Root server directs to TLD server, which is then queried for 'example.com'.
Step 4: Recursive server queries authoritative server
TLD server directs to authoritative DNS server for 'example.com', which returns the IP.
Final Answer:
Option A -> Option A
Quick Check:
Order matches DNS resolution hierarchy and recursive query flow -> correct
Hint: Recursive DNS server queries root -> TLD -> authoritative servers in order.
Common Mistakes:
Misplacing root server query after authoritative server
Confusing order of recursive and root server queries
Assuming local resolver queries root server directly
2. You need to design a RESTful API endpoint that retrieves user profile information without modifying any server data. Which HTTP method should you use to ensure the operation is safe and does not change server state?
easy
A. GET
B. POST
C. PUT
D. DELETE
Solution
Step 1: Understand the safety property of HTTP methods
GET is defined as a safe method, meaning it does not modify server state and is used to retrieve data.
Step 2: Analyze other methods
POST, PUT, and DELETE modify server state and are not safe methods.
Final Answer:
Option A -> Option A
Quick Check:
GET is the only safe method here, suitable for data retrieval without side effects.
Hint: GET = safe read, POST/PUT/DELETE = state change
Common Mistakes:
Confusing POST with GET as both can send data
Thinking PUT is safe because it replaces data
Assuming DELETE can be used to retrieve data
3. Trace the process of determining the network and host portions of the IP address 192.168.10.25 with subnet mask 255.255.255.240. What is the network address?
Step 3: Perform bitwise AND between IP and subnet mask
Result = 11000000.10101000.00001010.00010000 = 192.168.10.16
Step 4: Interpret result
The network address is 192.168.10.16, which identifies the subnet.
Final Answer:
Option D -> Option D
Quick Check:
Subnet mask 255.255.255.240 divides the last octet into 16-address blocks; 25 falls into 16-31 range [OK]
Hint: Network address = IP AND subnet mask
Common Mistakes:
Using the IP address itself as the network address
Using the subnet mask as the network address
Assuming the network address is always .0
4. Trace the sequence of layers a data packet passes through when a user sends an email using SMTP over TCP/IP. Which order correctly represents the encapsulation process from the sender's perspective?
easy
A. Application -> Transport -> Internet -> Network Interface
B. Network Interface -> Internet -> Transport -> Application
C. Internet -> Transport -> Application -> Network Interface
D. Transport -> Application -> Internet -> Network Interface
Solution
Step 1: Understand encapsulation order in TCP/IP model
Data starts at the Application Layer (SMTP), then is passed down to Transport Layer (TCP) for segmentation and connection management, then to Internet Layer (IP) for routing, and finally to Network Interface Layer for physical transmission.
Final Answer:
Option A -> Option A
Quick Check:
Encapsulation order is top-down: Application -> Transport -> Internet -> Network Interface [OK]
Hint: Encapsulation flows top-down from Application to Network Interface
Common Mistakes:
Confusing encapsulation with decapsulation order
Mixing up Internet and Transport layers
Assuming Network Interface is the first layer
5. Why might using TCP for a real-time multiplayer game cause performance issues compared to UDP?
medium
A. TCP packets are always larger than UDP packets, increasing bandwidth usage
B. TCP does not support packet loss detection, causing inconsistent game state
C. UDP requires establishing a connection first, which delays game startup
D. TCP's retransmission and ordering guarantees introduce latency that can disrupt real-time responsiveness
Solution
Step 1: Identify real-time game requirements
Low latency and timely updates are critical; some packet loss is tolerable.
Step 2: Analyze TCP behavior
TCP ensures reliability and ordered delivery by retransmitting lost packets, which adds latency.
Step 3: Analyze UDP behavior
UDP sends packets without retransmission or ordering, reducing delay.
Step 4: Evaluate options
TCP's retransmission and ordering guarantees introduce latency that can disrupt real-time responsiveness correctly explains TCP's latency impact. TCP does detect packet loss, so TCP does not support packet loss detection, causing inconsistent game state is incorrect. UDP is connectionless, so UDP requires establishing a connection first, which delays game startup is incorrect. Packet size depends on payload, so TCP packets are always larger than UDP packets, increasing bandwidth usage is incorrect.
Final Answer:
Option D -> Option D
Quick Check:
TCP's reliability mechanisms add latency unsuitable for real-time games.
Hint: TCP = reliable but slower; UDP = faster but less reliable.
Common Mistakes:
Believing TCP does not detect packet loss
Thinking UDP requires connection setup
Assuming TCP packets are always larger
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.