Lecture6
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
time
Seq=92 timeout
timeout
TCP retransmission scenarios
Host A Host B
timeout
X
SendBase = 120
time
Cumulative ACK scenario
College of Software,NKU 14
TCP ACK generation [RFC 1122, RFC 2581]
Computer Networking Lecture 6
College of Software,NKU
1
Chapter 3
Transport Layer
3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control
SampleRTT: measured time from segment transmission until ACK receipt ignore retransmissions SampleRTT will vary, estimated RTT “smoother” average several recent measurements, not just current SampleRTT
Counting by bytes ACK: ACK # valid
RST, SYN, FIN: connection estab (setup, teardown commands)
College of Software,NKU
5
TCP seq. #’s and ACKs
Seq. #’s: byte stream “number” of first byte in segment’s data ACKs: seq # of next byte expected from other side cumulative ACK
Event at Receiver TCP Receiver action
Arrival of in-order segment with Delayed ACK. Wait up to 500ms expected seq #. All data up to for next segment. If no next segment, expected seq # already ACKed send ACK Arrival of in-order segment with Immediately send single cumulative expected seq #. One other ACK, ACKing both in-order segments segment has ACK pending Arrival of out-of-order segment higher-than-expect seq. # . Gap detected Arrival of segment that partially or completely fills gap Immediately send duplicate ACK, indicating seq. # of next expected byte Immediate send ACK, provided that segment starts at lower end of gap
Retransmissions are triggered by:
timeout events duplicate acks ignore duplicate acks ignore flow control, congestion control
College of Software,NKU 10
Host A Host B
User types ‘C’
host ACKs receipt of ‘C’, echoes back ‘C’
host ACKs receipt of echoed ‘C’
simple telnet scenario
College of Software,NKU
time
6
TCP Round Trip Time and Timeout
College of Software,NKU
9
TCP reliable data transfer
TCP creates rdt service on top of IP’s unreliable service Pipelined segments Cumulative acks TCP uses single retransmission timer
Q: how to set TCP timeout value?
longer than RTT :but RTT varies too short: premature timeout unnecessary retransmissions too long: slow reaction to segment loss
College of Software,NKU 3
Contrast with UDP
How to establish TCP connection?
Three-way handshake exchange of control msgs: initiate sender, receiver state before data exchange MSS: (maximum segment size) Controlled by OS:1500/536/512bytes MTU: controlled by link
TCP: Retransmission scenarios
Host A Host B
loss Seq=100
X
SendBase = 100
?
SendBase = 120
time premature timeout
College of Software,NKU 13
lost ACK scenario
application writes data TCP send buffer
segment
College of Software,NKU 4
socket door
application reads data TCP receive buffer
socket door
TCP Segment Structure
College of Software,NKU
2
3.5 TCP: Overview
Characteristics of TCP
RFCs: 793, 1122, 1323, 2018, 2581
full duplex data connection-oriented Point-to-point: is not fit for multicasting reliable, in-order byte steam: no “message boundaries” pipelined: TCP congestion and flow control set window size same: multiplexing, de-multiplexing,error detection different: TCP is connection-oriented, UDP is connectionless
retransmit segment that caused timeout restart timer If acknowledges previously unacked segments update what is known to be acked College of Software,NKU start timer if there are outstanding segments
ቤተ መጻሕፍቲ ባይዱ
Initially consider simplified TCP sender:
TCP sender events:
data rcvd from app:
timeout:
Create segment with seq # seq # is byte number of first data byte in segment start timer if not already running (think of timer as for oldest unacked segment) expiration interval: TimeOutInterval
College of Software,NKU
8
TCP Round Trip Time and Timeout
Setting the timeout
EstimtedRTT plus “safety margin” large variation in EstimatedRTT -> larger safety margin first estimate of how much SampleRTT deviates from EstimatedRTT: DevRTT = (1-)*DevRTT + *|SampleRTT-EstimatedRTT| (typically, = 0.25) TimeoutInterval = EstimatedRTT + 4*DevRTT
RTT: to fantasia.eurecom.fr
350
300
RTT (milliseconds)
250
200
150
100 1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106 time (seconnds) SampleRTT Estimated RTT
College of Software,NKU 7
Q: how to estimate RTT?
TCP Round Trip Time and Timeout
EstimatedRTT = (1- )*EstimatedRTT + *SampleRTT
typical value: = 0.125
Ack rcvd:
11
NextSeqNum = InitialSeqNum SendBase = InitialSeqNum TCP sender loop (forever) { switch(event) (simplified) event: data received from application above create TCP segment with sequence number NextSeqNum start timer for segment NextSeqNum Comment: pass segment to IP • SendBase-1: last NextSeqNum = NextSeqNum + length(data) cumulatively break; ack’ed byte event: timer timeout for segment with sequence number y Example: retransmit segment with sequence number y • SendBase-1 = 71; compute new timeout interval for segment y y= 73, so the rcvr break; wants 73+ ; event: ACK received, with ACK field value of y if (y > SendBase) { y > SendBase, so cancel all timers for segments with sequence numbers <y that new data is SendBase = y acked } else{ increment number of duplicate ACKs received for y if( number of duplicate ACKs received for y==3){ resend segment with sequence number y start timer for segment y } } break; College of Software,NKU } /* end of loop forever */ 12