Download TCP - Internet - Lecture Slides and more Slides Internet and Information Access in PDF only on Docsity!
TCP - Part II
What is Flow/Congestion/Error Control
2
- Flow Control: Algorithms to prevent that the sender
overruns the receiver with information
- Error Control: Algorithms to recover or conceal the
effects from packet losses
- Congestion Control: Algorithms to prevent that the sender
overloads the network
ļ The goal of each of the control mechanisms are different.
ļ In TCP, the implementation of these algorithms is combined
Sequence Numbers and Acknowledgments in TCP
- TCP uses sequence numbers to keep track of transmitted and acknowledged data
- Each transmitted byte of payload data is associated with a sequence number
- Sequence numbers count bytes and not segments
- Sequence number of first byte in payload is written in SeqNo field
- Sequence numbers wrap when they reach 232 -
- The sequence number of the first sequence number (Initial sequence number) is negotiated during connection setup
Sequence number (SeqNo) (32 bits)
Source Port Number Destination Port Number
Acknowledgement number (AckNo)(32 bits) headerlength 0 Flags window size TCP checksum urgent pointer
Sequence Numbers and Acknowledgments in TCP
- An acknowledgment is a confirmation of delivery of data
- When a TCP receiver wants to acknowledge data, it - writes a sequence number in the AckNo field, and - sets the ACK flag
IMPORTANT: An acknowledgment confirms receipt for all unacknowledged data that has a smaller sequence number than given in the AckNo field
Example: AckNo=5 confirms delivery for 1,2,3,4 (but not 5).
Sequence number (SeqNo) (32 bits)
Source Port Number Destination Port Number
Acknowledgement number (AckNo)(32 bits) headerlength 0 Flags window size TCP checksum urgent pointer
Cumulative Acknowledgements
⢠With cumulative ACKs, the receiver can only
acknowledge a segment if all previous segments have
been received
⢠With cumulative ACKs, receiver cannot selectively
acknowledge blocks of segments:
e.g., ACK for S 0 -S 3 and S 5 -S 7 (but not for S 4 )
⢠Note: The use of cumulative ACKs imposes constraints
on the retransmission schemes:
- In case of an error, the sender may need to retransmit all
data that has not been acknowledged
Rules for sending Acknowledgments
- TCP has rules that influence the transmission of
acknowledgments
- Rule 1: Delayed Acknowledgments
- Goal: Avoid sending ACK segments that do not carry data
- Implementation: Delay the transmission of (some) ACKs
- Rule 2: Nagleās rule
- Goal: Reduce transmission of small segments
Implementation: A sender cannot send multiple segments
with a 1-byte payload (i.e., it must wait for an ACK)
Observing Delayed Acknowledgements
- This is the output of typing 3 (three) characters :
Time 44.062449: Argon ļ Neon: Push, SeqNo 0:1(1), AckNo 1 Time 44.063317: Neon ļ Argon: Push, SeqNo 1:2(1), AckNo 1 Time 44.182705: Argon ļ Neon: No Data, AckNo 2 Time 48.946471: Argon ļ Neon: Push, SeqNo 1:2(1), AckNo 2 Time 48.947326: Neon ļ Argon: Push, SeqNo 2:3(1), AckNo 2 Time 48.982786: Argon ļ Neon: No Data, AckNo 3 Time 55.116581: Argon ļ Neon: Push, SeqNo 2:3(1) AckNo 3 Time 55.117497: Neon ļ Argon: Push, SeqNo 3:4(1) AckNo 3 Time 55.183694: Argon ļ Neon: No Data, AckNo 4
10
Argon Neon
Telnet session from Argon to Neon
Why 3 segments per character?
- We would expect four segments per character:
- But we only see three segments per character:
- This is due to delayed acknowledgements
11
character ACK of character
ACK of echoed character
echo of character
character ACK and echo of character
ACK of echoed character
- Because of delayed ACKs, an ACK is often observed
for every other segment
13
Delayed Acknowledgement
A
B
Max. Delay for an ACK Docsity.com
Observing Nagleās Rule
⢠This is the output of typing 7 characters :
Time 16.401963: Argon ļ Tenet: Push, SeqNo 1:2(1), AckNo 2 Time 16.481929: Tenet ļ Argon: Push, SeqNo 2:3(1) , AckNo 2 Time 16.482154: Argon ļ Tenet: Push, SeqNo 2:3(1) , AckNo 3 Time 16.559447: Tenet ļ Argon: Push, SeqNo 3:4(1), AckNo 3 Time 16.559684: Argon ļ Tenet: Push, SeqNo 3:4(1), AckNo 4 Time 16.640508: Tenet ļ Argon: Push, SeqNo 4:5(1) AckNo 4 Time 16.640761: Argon ļ Tenet: Push, SeqNo 4:8(4) AckNo 5 Time 16.728402: Tenet ļ Argon: Push, SeqNo 5:9(4) AckNo 8 14
argon.cs.virginia.edu
3000 miles
tenet.cs.berkeley.edu
Telnet session between argon.cs.virginia.edu and tenet.cs.berkeley.edu
Observing Nagleās Rule
- Observations:
- Argon never has multiple unacknowledged segments outstanding
- There are fewer transmissions than there are characters.
- This is due to Nagleās Rule:
- Each TCP connection can have only one small (1-byte) segment outstanding that has not been acknowledged
- Implementation: Send one byte and buffer all subsequent bytes until acknowledgement is received.Then send all buffered bytes in a single segment. (Only enforced if byte is arriving from application one byte at a time)
- Goal of Nagleās Rule: Reduce the amount of small segments.
- The algorithm can be disabled.
- Only one 1-byte segment can be in transmission (Here: Since no data is sent from B to A, we also see delayed ACKs)
17
A
B
Nagleās Rule
Typed characters
Delayed ACK (^) Delayed ACK Delayed ACKDocsity.com
TCP Flow Control
⢠TCP uses a version of the sliding window flow
control, where
- Sending acknowledgements is separated from setting the
window size at sender
- Acknowledgements do not automatically increase the
window size
⢠During connection establishment, both ends of a
TCP connection set the initial size of the sliding
window
Window Management in TCP
⢠The receiver is returning two parameters to the sender
⢠The interpretation is:
- I am ready to receive new data with SeqNo= AckNo, AckNo+1, ā¦., AckNo+Win-
⢠Receiver can acknowledge data without opening the
window
⢠Receiver can change the window size without
acknowledging data
20
AckNo window size(win) 32 bits 16 bits