计算机网络lecture-11-TCP
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
DevRTT = (1-)*DevRTT + *|SampleRTT-EstimatedRTT| (typically, = 0.25) Then set timeout interval: TimeoutInterval = EstimatedRTT + 4*DevRTT
Transport Layer 3-10
Transport Layer 3-12
TCP sender events:
data rcvd from app: • Create segment with seq # • seq # is byte-stream number of first data byte in segment • start timer if not already running (think of timer as for oldest unacked segment) • expiration interval: TimeOutInterval timeout: • retransmit segment that caused timeout • restart timer Ack rcvd: • If acknowledges previously unacked segments – update what is known to be acked – start timer if there are outstanding segments
• point-to-point: – one sender, one receiver • reliable, in-order byte
steam:
– no “message boundaries” • pipelined: – TCP congestion and flow control set window size • send & receive buffers
TCP Round Trip Time and Timeout
Q: how to set TCP timeout value?
• longer than RTT – but RTT varies • too short: premature timeout
Q: how to estimate RTT?
Transport Layer
3-9
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:
TCP reliable data transfer
TCP reliable data transfer
• TCP creates rdt service on top of IP’s unreliable service • Pipelined segments • Cumulative acks • TCP uses single retransmission timer • Retransmissions are triggered by: – timeout events – duplicate acks • Initially consider simplified TCP sender: – ignore duplicate acks – ignore flow control, congestion control
Transport Layer
3-4
TCP seq. #’s and ACKs
Seq. #’s:
– byte stream “number” of first byte in segment’s data
ACKs:
Host A
User types ‘C’
Host B
– seq # of next byte expected from other side – cumulative ACK
RTT: gaia.cs.umass.edu 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
socket door
Transport Layer
3-3
TCP segment structure
32 bits
URG: urgent data (generally not used) ACK: ACK # valid PSH: push data now (generally not used)
• too long: slow reaction to segment loss
– average several recent measurements, not just current SampleRTT
Transport Layer
3-7
TCP Round Trip Time and Timeout EstimatedRTT = (1- )*EstimatedRTT + *SampleRTT
• For TCP, we learn its
– – – – segment structure reliable data transfer flow control connection management
TCP: Overview
RFCs: 793, 1122, 1323, 2018, 2581
socket door
application writes data TCP send buffer
segment
application reads data TCP receive buffer
• full duplex data: – bi-directional data flow in same connection – MSS: maximum segment size • connection-oriented: – handshaking (exchange of control msgs) init’s sender, receiver state before data exchange • flow controlled: – sender will not overwhelm receiver
Computer Networking Lecture 11
TCP: Transmission Control Protocol
Oct 14, 2013 Dr. Chunhua Chen chunhuachen@scut.edu.cn
Some slides are from lectures of Prof. J.F Kurose and K.W. Ross
• SampleRTT: measured time from segment transmission until ACK receipt
– ignore retransmissions
• SampleRTT will vary, want estimated RTT “smoother”
– unnecessary retransmissions
Our goals
• learn about transport layer protocols in the Internet:
– UDP: connectionless transport – TCP: connection-oriented transport – TCP congestion control
(simplified)
TCP sender
event: ACK received, with ACK field value of y if (y > SendBase) { SendBase = y if (there are currently not-yet-acknowledged segments) start timer }
source port #
dest port #
sequence number
head not UA P R S F len used
acknowledgement number
Receive window checksum
counting by bytes of data (not segments!) # bytes rcvr willing to accept
Transport Layer 3-14
TCP: retransmission scenarios
Host A Host B Host A Host B
loss
Sendbase = 100 SendBase = 120
} /* end of loop forever */
Comment: • SendBase-1: last cumulatively ack’ed byte Example: • SendBase-1 = 71; y= 73, so the rcvr wants 73+ ; y > SendBase, so that new data is acked
Urg data pnter
RST, SYN, FIN: connection estab (setup, teardown commands) Internet checksum (as in UDP)
Options (variable length)
application data (variable length)
Transport Layer 3-13
NextSeqNum = InitialSeqNum SendBase = InitialSeqNum loop (forever) { switch(event) event: data received from application above create TCP segment with sequence number NextSeqNum if (timer currently not running) start timer pass segment to IP NextSeqNum = NextSeqNum + length(data) event: timer timeout retransmit not-yet-acknowledged segment with smallest sequence number start timer
Exponential weighted moving average influence of past sample decreases exponentially fast typical value: = 0.125
Transport Layer
3-8
Example RTT estimation:
Q: how receiver handles out-of-order segments
பைடு நூலகம்
host ACKs receipt of ‘C’, echoes back ‘C’
– A: TCP spec doesn’t say, - up to implementor
host ACKs receipt of echoed ‘C’
simple telnet scenario
Transport Layer
time
3-5
Review: 16th Oct 2013 • TCP segment structure
– – – – Sequence number acknowledgement number Receive window …