Download TCP flow and error control

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Flow control in TCP
• End-to-end control across a path possibly passing through
multiple networks (internet transport protocol)
• Flow Control:
How to prevent receiver buffer overflows?
• Flow Control in TCP
• Window-based flow control
• Called sliding window flow control
Malathi Veeraraghavan
Originals by Jörg Liebeherr
1
TCP header fields related to flow control and error
control
• Three fields of interest to error control and flow control in the TCP header
32-bit SeqNo
32-bit AckNo
16-bit
window size
• The interpretation of the AckNo and Window size fields:
• The sender of the TCP segment with the Ack Number field set
to “AckNo” and Window size field set to “Win” is
communicating to the far end that it is ready to receive new
data with
SeqNo= AckNo, AckNo+1, …., AckNo+Win-1
• Receiver can acknowledge data without opening the window
• Receiver can change the window size without acknowledging data
Malathi Veeraraghavan
Originals by Jörg Liebeherr
2
TCP header fields - Sequence Number
• Sequence Number (SeqNo):
– Sequence number is 32 bits long.
– So the range of SeqNo is
0 <= SeqNo <= 232 -1  4.3 Gbyte
– The sequence number identifies the byte in the stream
of data from the sending TCP to the receiving TCP that
the first byte of data in this segment represents.
– Initial Sequence Number (ISN) of a connection is set
during connection establishment
1
500
Segment 1
(Seq. No. 1)
Malathi Veeraraghavan
Originals by Jörg Liebeherr
501
1000
Segment 2
(Seq. No. 501)
1001
1500
Segment 3
(Seq. No. 1001)
3
Sliding Window Flow Control
• Sliding Window Protocol is performed at the byte level:
Advertised window
1
2
sent and
acknowledged
3
4
5
sent but not
acknowledged
6
7
8
can be sent
USABLE
WINDOW
9
10 11
can't send
•Here: Sender can transmit sequence numbers 6,7,8.
Malathi Veeraraghavan
Originals by Jörg Liebeherr
4
Sliding Window: “Window Closes”
• Transmission of a single byte (with SeqNo = 6) and acknowledgement is
received (AckNo = 5, Win=4):
1
2
3
4
5
6
7
8
9
10 11
Transmit Byte 6
1
2
3
4
5
6
7
8
9
10 11
AckNo = 5, Win = 4
is received
1
Malathi Veeraraghavan
Originals by Jörg Liebeherr
2
3
4
5
6
7
8
9
10 11
5
Sliding Window: “Window Opens”
• Acknowledgement is received that enlarges the window to the right
(AckNo = 5, Win=6):
1
2
3
4
5
6
7
8
9
10 11
AckNo = 5, Win = 6
is received
1
2
3
4
5
6
7
8
9
10 11
• A receiver opens a window when TCP buffer empties (meaning that data
is delivered to the application).
Malathi Veeraraghavan
Originals by Jörg Liebeherr
6
Sliding Window: “Window Shrinks”
• Acknowledgement is received that reduces the window from the right
(AckNo = 5, Win=3):
1
2
3
4
5
6
7
8
9
10 11
AckNo = 5, Win = 3
is received
1
2
3
4
5
6
7
8
9
10 11
• Shrinking a window should not be used - Host requirements RFC strongly
discourages this
Malathi Veeraraghavan
Originals by Jörg Liebeherr
7
Sliding Window: Example
Sender
sends
2048B of
data
Receiver
Buffer
4096
0
SeqNo=0
2048
Sender blocked
Sender
sends
2048B of
data
Win=2048
AckNo=2048
SeqNo=2048
4096
AckNo=4096
3072
AckNo=4096
Malathi Veeraraghavan
Originals by Jörg Liebeherr
Win=0
Win=1024
8
TCP error control
• Cumulative ACKs are used
• In popular implementations, an ACK-every-other-segment
strategy is used
• Sender keeps an associated timeout value for segments sent.
If an ACK is not received before the timer times out, it resends
the segment
• Retransmission scheme is Go-Back-N ARQ
• But Selective repeat along with Selective ACKs have been
added as extensions
• Piggybacking of ACKs on data segments is indeed used.
• If there is no data to send before a delayed-ACK timer
expires, a zero-payload segment is sent as an ACK
Malathi Veeraraghavan
Originals by Jörg Liebeherr
9