Announcement.ppt

上传人:boatfragile160 文档编号:378417 上传时间:2018-10-09 格式:PPT 页数:29 大小:351KB
下载 相关 举报
Announcement.ppt_第1页
第1页 / 共29页
Announcement.ppt_第2页
第2页 / 共29页
Announcement.ppt_第3页
第3页 / 共29页
Announcement.ppt_第4页
第4页 / 共29页
Announcement.ppt_第5页
第5页 / 共29页
亲,该文档总共29页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

1、1,Announcement,Project 2 out Much harder than project 1, start early!Homework 2 due next Tuesday,2,Previous Lecture,Reliable transfer protocols rdt 2.0: data corruption - ACK/NAK rdt2.1: ACK/NAK corruption - Seq # in data rdt2.2: a NAK-free protocol - Seq # in ACKs rdt3.0: channels with errors and l

2、oss Retransmission timeout Pipelined protocols Go-back-N Selective repeat,3,Go-Back-N,Sender: k-bit seq # in pkt header (the range of 0 , 2k - 1) “window” of up to N, consecutive unacked pkts allowed,ACK(n): ACKs all pkts up to, including seq # n - “cumulative ACK” may deceive duplicate ACKs (see re

3、ceiver) One timer for all packets in-flight timeout: retransmit all packets in flight,4,Selective repeat: sender, receiver windows,5,Outline,Connection-oriented transport: TCP Overview and segment structure Reliable data transfer Flow control Connection management,6,TCP: Overview RFCs: 793, 1122, 13

4、23, 2018, 2581,full duplex data: bi-directional data flow in same connection MSS: maximum segment size connection-oriented: handshaking (exchange of control msgs) inits sender, receiver state before data exchange flow controlled: sender will not overwhelm receiver,point-to-point: one sender, one rec

5、eiver reliable, in-order byte steam: no “message boundaries” pipelined: TCP congestion and flow control set window size send & receive buffers,7,TCP segment structure,URG: urgent data (generally not used),ACK: ACK # valid,PSH: push data now (generally not used),RST, SYN, FIN: connection estab (setup

6、, teardown commands),# bytes rcvr willing to accept,counting by bytes of data (not segments!),Internet checksum (as in UDP),8,TCP seq. #s and ACKs,Seq. #s: byte stream “number” of first byte in segments data ACKs: seq # of next byte expected from other side cumulative ACK Q: how receiver handles out

7、-of-order segments A: TCP spec doesnt say, - up to implementor,Host A,Host B,Seq=42, ACK=79, data = C,Seq=79, ACK=43, data = C,Seq=43, ACK=80,User types C,host ACKs receipt of echoed C,host ACKs receipt of C, echoes back C,simple telnet scenario,9,TCP Round Trip Time and Timeout,Q: how to set TCP ti

8、meout value? longer than RTT but RTT varies too short: premature timeout unnecessary retransmissions too long: slow reaction to segment loss,Q: how to estimate RTT? SampleRTT: measured time from segment transmission until ACK receipt ignore retransmissions SampleRTT will vary, want estimated RTT “sm

9、oother” average several recent measurements, not just current SampleRTT,10,TCP Round Trip Time and Timeout,EstimatedRTT = (1- )*EstimatedRTT + *SampleRTT,Exponential weighted moving average influence of past sample decreases exponentially fast typical value: = 0.125The weighted average puts more wei

10、ght on recent samples which better reflect the current congestion,11,Example RTT estimation:,12,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:

11、,TimeoutInterval = EstimatedRTT + 4*DevRTT,DevRTT = (1-)*DevRTT +*|SampleRTT-EstimatedRTT|(typically, = 0.25),Then set timeout interval:,13,Outline,Connection-oriented transport: TCP Overview and segment structure Reliable data transfer Flow control Connection management,14,TCP reliable data transfe

12、r,TCP creates rdt service on top of IPs 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 Use only timeout ignore flow control, cong

13、estion control,15,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),timeout: retransmit segment that caused timeout restart timerAck rcvd: If ack

14、nowledges previously unacked segments update what is known to be acked start timer if there are outstanding segments,16,TCP sender (simplified),NextSeqNum = InitialSeqNumSendBase = InitialSeqNumloop (forever) switch(event) event: data received from application above create TCP segment with sequence

15、number NextSeqNum if (timer currently not running)start timerpass segment to IP NextSeqNum = NextSeqNum + length(data) event: timer timeoutretransmit not-yet-acknowledged segment with smallest sequence numberstart timerevent: ACK received, with ACK field value of y if (y SendBase) SendBase = yif (th

16、ere are currently not-yet-acknowledged segments)start timer /* end of loop forever */,Comment:SendBase-1: last cumulatively acked byte Example:SendBase-1 = 71; y= 73, so the rcvr wants 73+ ; y SendBase, so that new data is acked,17,TCP: retransmission scenarios,Host A,Seq=100, 20 bytes data,ACK=100,

17、premature timeout,Host B,Seq=92, 8 bytes data,ACK=120,Seq=92, 8 bytes data,ACK=120,Seq=92 timeout,SendBase = 100,SendBase = 120,SendBase = 120,Sendbase = 100,18,TCP retransmission scenarios (more),SendBase = 120,timeout: When timeout expires after T0 no packet was received for the last TO period Cou

18、ld be a congestion TO=2*TO,19,TCP ACK generation RFC 1122, RFC 2581,Event at ReceiverArrival of in-order segment with expected seq #. All data up to expected seq # already ACKedArrival of in-order segment with expected seq #. One other segment has ACK pendingArrival of out-of-order segment higher-th

19、an-expect seq. # . Gap detectedArrival of segment that partially or completely fills gap,TCP Receiver actionDelayed ACK. Wait up to 500ms for next segment. If no next segment, send ACKImmediately send single cumulative ACK, ACKing both in-order segments Immediately send duplicate ACK, indicating seq

20、. # of next expected byteImmediate send ACK, provided that segment starts at lower end of gap,20,Fast Retransmit,Time-out period often relatively long: long delay before resending lost packet Detect lost segments via duplicate ACKs. Sender often sends many segments back-to-back If segment is lost, t

21、here will likely be many duplicate ACKs.,If sender receives 3 ACKs for the same data, it supposes that segment after ACKed data was lost: fast retransmit: resend segment before timer expires,21,event: ACK received, with ACK field value of y if (y SendBase) SendBase = yif (there are currently not-yet

22、-acknowledged segments)start timer else increment count of dup ACKs received for yif (count of dup ACKs received for y = 3) resend segment with sequence number y,Fast retransmit algorithm:,a duplicate ACK for already ACKed segment,fast retransmit,22,Outline,Connection-oriented transport: TCP Overvie

23、w and segment structure Reliable data transfer Flow control Connection management,23,TCP Flow Control,receive side of TCP connection has a receive buffer:,speed-matching service: matching the send rate to the receiving apps drain rate,app process may be slow at reading from buffer,24,TCP Flow contro

24、l: how it works,(Suppose TCP receiver discards out-of-order segments) spare room in buffer = RcvWindow = RcvBuffer-LastByteRcvd - LastByteRead,Rcvr advertises spare room by including value of RcvWindow in segments Sender limits unACKed data to RcvWindow guarantees receive buffer doesnt overflowPatho

25、logical scenario RcvWindow=0 Sender has no packets to send,25,Outline,Connection-oriented transport: TCP Overview and segment structure Reliable data transfer Flow control Connection management,26,TCP Connection Management,Recall: TCP sender, receiver establish “connection” before exchanging data se

26、gments initialize TCP variables: seq. #s buffers, flow control info (e.g. RcvWindow) client: connection initiatorSocket clientSocket = new Socket(“hostname“,“port number“); server: contacted by clientSocket connectionSocket = welcomeSocket.accept();,Three way handshake: Step 1: client host sends TCP

27、 SYN segment to server specifies initial seq # no data Step 2: server host receives SYN, replies with SYNACK segment server allocates buffers specifies server initial seq. # Step 3: client receives SYNACK, replies with ACK segment, which may contain data,27,TCP Connection Management (cont.),Closing

28、a connection: client closes socket: clientSocket.close(); Step 1: client end system sends TCP FIN control segment to server Step 2: server receives FIN, replies with ACK. Closes connection, sends FIN.,28,TCP Connection Management (cont.),Step 3: client receives FIN, replies with ACK. Enters “timed wait” - will respond with ACK to received FINs Step 4: server, receives ACK. Connection closed.,client,FIN,server,ACK,ACK,FIN,closing,closing,closed,timed wait,closed,29,TCP Connection Management (cont),TCP client lifecycle,TCP server lifecycle,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 教学课件 > 大学教育

copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1