版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Chapter 3: Transport Layer,Our goals: understand principles behind transport layer services: multiplexing/demultiplexing reliable data transfer flow control congestion control,learn about transport layer protocols in the Internet: UDP: connectionless transport TCP: connection-oriented transport TCP
2、congestion control,Chapter 3 outline,3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer rdt Model GBN(Go Back N) SR(Selective Repeat ),3.5 Connection-oriented transport: TCP segment structure reliable data trans
3、fer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control,Transport services and protocols,provide logical communication between app processes running on different hosts transport protocols run in end systems send side: breaks app messages into segments,
4、passes to network layer rcv side: reassembles segments into messages, passes to app layer more than one transport protocol available to apps Internet: TCP and UDP,Transport vs. network layer,network layer: logical communication between hosts transport layer: logical communication between processes r
5、elies on , enhances, network layer services,Internet transport-layer protocols,reliable, in-order delivery (TCP) congestion control flow control connection setup unreliable, unordered delivery (UDP) : no-frills extension of “best-effort” IP (不对”尽最大努力服务” 的IP协议进行不必要的扩展) services not available (QoS) :
6、delay guarantees bandwidth guarantees,Quality of Services,Chapter 3 outline,3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer rdt Model GBN(Go Back N) SR(Selective Repeat ),3.5 Connection-oriented transport: TC
7、P segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control,Multiplexing/demultiplexing,application,transport,network,link,physical,P1,application,transport,network,link,physical,application,transport,network,link,phys
8、ical,P2,P3,P4,P1,host 1,host 2,host 3,How demultiplexing works,host receives IP datagrams each datagram has source IP address, destination IP address each datagram carries 1 transport-layer segment,IP datagram format,2B,4.13,How demultiplexing works,host receives IP datagrams each segment has source
9、, destination port number host uses IP addresses DatagramSocket mySocket2 = new DatagramSocket(99222); UDP socket identified by two-tuple: (dest IP address, dest port number),When host receives UDP segment: checks destination port number in segment directs UDP segment to socket with that port number
10、 IP datagrams with different source IP addresses and/or source port numbers directed to same socket,Connectionless demux (cont),DatagramSocket serverSocket = new DatagramSocket(6428);,SP provides “return address”,Connection-oriented demux,TCP socket identified by 4-tuple: source IP address source po
11、rt number dest IP address dest port number recv host uses all four values to direct segment to appropriate socket,Server host may support many simultaneous TCP sockets: each socket identified by its own 4-tuple Web servers have different sockets for each connecting client,Connection-oriented demux (
12、cont),Client IP:B,server IP: C,SP: 9157,DP: 80,D-IP:C,S-IP: A,D-IP:C,S-IP: B,D-IP:C,S-IP: B,Web Server Thread/subprocess,Chapter 3 outline,3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer rdt Model GBN(Go Back
13、 N) SR(Selective Repeat ),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,UDP: User Datagram Protocol RFC 768,“best effort” service, UDP segments may be: lost delivered
14、out of order to app connectionless: no handshaking between UDP sender, receiver each UDP segment handled independently of others,Why is there a UDP? no connection establishment (which can add delay) simple: no connection state at sender, receiver small segment header no congestion control: UDP can b
15、last away (拼命)as fast as desired,UDP: more,often used for streaming multimedia apps loss tolerant rate sensitive other UDP uses DNS SNMP reliable transfer over UDP: add reliability at application layer application-specific error recovery!,UDP checksum,Sender: treat segment contents as sequence of 16
16、-bit integers checksum: addition (1s complement sum) of segment contents sender puts checksum value into UDP checksum field,Receiver: compute checksum of received segment if computed checksum equals checksum field value: no error detected But maybe errors,Goal: detect “errors” in transmitted segment
17、,Internet Checksum Example,Note When adding numbers, a carry from the most significant bit needs to be added to the result Example: add two 16-bit integers,Internet Checksum Example,Example: add three 16-bit integers, 0110011001100000,0101010101010101,1000111100001100,Chapter 3 outline,3.1 Transport
18、-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer rdt Model GBN(Go Back N) SR(Selective Repeat ),3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Princip
19、les of congestion control 3.7 TCP congestion control,Reliable data transfer: getting started,rdt:send side,rdt: receive side,Chapter 3 outline,3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer rdt Model GBN(Go
20、Back N) SR(Selective Repeat ),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,Go-Back-N (GBN),Slide Window,Sender: k-bit seq # in pkt header:seq#=0-2k-1 “window” of up t
21、o N, consecutive unacked pkts allowed,连续的未被确认的包的最大数量 (序号窗口、窗口、滑动窗口),Go-Back-N (GBN),Sliding Windows, size N,Sliding Windows, size N,Sliding Windows, size N,Sliding-Window protocol,收到base包的ACK后:,收到base包的ACK后:,Slide Window,Go-Back-N(GBN),ACK(n): ACKs all pkts up to, including seq # n - “cumulative ACK
22、 (累计确认)” may receive duplicate ACKs (see receiver) Timer: running at sender side so that time for base pkt timeout: sender resend all pkts that have been previously sent but that have not yet been acked,GBN: sender FSM(Finite-State-Machine),GBN: receiver FSM,ACK-only: always send ACK for correctly-r
23、eceived pkt with highest in-order seq # may generate duplicate ACKs need only remember expectedseqnum out-of-order pkt: discard (dont buffer) - no receiver buffering! Re-ACK pkt with highest in-order seq #,发送窗口尺寸为N,接收窗口尺寸为1。 Q: N的最大值?,28,GBN in action,X,W6,W=expectedseqnum,Chapter 3 outline,3.1 Tran
24、sport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer rdt Model GBN(Go Back N) SR(Selective Repeat ),3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Pr
25、inciples of congestion control 3.7 TCP congestion control,Selective Repeat (SR),receiver individually acknowledges all correctly received pkts buffers pkts, as needed, for eventual in-order delivery to upper layer sender only resends pkts for which ACK not received sender timer for each unACKed pkt
26、sender window N consecutive seq #s Receiver window N consecutive seq #s also,Selective repeat: sender, receiver windows,Selective repeat (SR),data from above : if nextseqnumsend_base+N, then send pkt with this seq # timeout(n): resend pkt n, restart timer ACK(n) in send_base,send_base+N-1: mark pkt
27、n as ACKed if n=send_base , then advance window base to next unACKed seq #,pkt n in rcv_base, rcv_base+N-1 send ACK(n) out-of-order: buffer in-order: deliver (also deliver buffered, in-order pkts), advance window to next not-yet-received pkt pkt n in rcv_base-N,rcv_base-1 Resend ACK(n) otherwise: ig
28、nore,Selective repeat in action,Selective repeat: dilemma(困难的选择窗口大小),Example: seq #s: 0, 1, 2, 3 window size N=3 No Problem when pkt loss incorrectly deliver duplicate data when ACK loss as new data in (a),Selective repeat: dilemma,Question: what relationship between seq # size and window size? Answ
29、er: for k-bit seq # , i.e. seq # size=2k, and window-size N2k/2=2k-1,Chapter 3 outline,3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer rdt Model GBN(Go Back N) SR(Selective Repeat ),3.5 Connection-oriented tr
30、ansport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control,TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581,full duplex data: bi-directional data flow in same connection connection-oriented: handshaking (exc
31、hange of control msgs) inits sender, receiver state before data exchange flow controlled: sender will not overwhelm receiver,point-to-point: one sender, one receiver pipelined: TCP congestion and flow control set window size reliable, in-order byte steam: no “message boundaries” send server: contact
32、ed by client Socket connectionSocket = welcomeSocket.accept();,Create connectionThree way handshake: Step 1: client host sends TCP SYN segment to server specifies initial seq # no data Step 2: server host receives SYN, replies with SYNACK segment specifies server initial seq. # Step 3: client receiv
33、es SYNACK, replies with ACK segment, which may contain data server allocates buffers,SYN synchronization,62,Create TCP connectionThree way handshake,Request(SYN=1,seq=client_isn),SYN=1,seq=server_isn,ACK=cliect_isn+1,SYN=0,seq=client_isn+1,ACK=server_isn+1,Server,Client,OK,connected,OK,connected,isn
34、=initial sequence number,TCP Connection Management (cont.),Three-Way Handshake,Why?,Conn granted,仅仅是“准许”连接!,SYNACK Segment,SYN Segment,63,Server,Client,I dont known!,OK,accept it!,isn=initial sequence number,OK,connected,communicating,Resent Request(SYN=1,seq=client_isn),OK,accept it!,Create TCP con
35、nectionThree way handshake,TCP Connection Management (cont.),The Server will create a false-connection when it receives a delayed connection-request!,timeout,TCP Connection Management (cont.),Closing a connection: client closes socket: clientSocket.close(); Step 1: client sends TCP FIN control segme
36、nt to server Step 2: server receives FIN, replies with ACK. Closes connection, sends FIN.,FINFINish,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,FI
37、N,server,ACK,ACK,FIN,closing,closing,closed,timed wait,closed,TCP Connection Management (cont),TCP client lifecycle,TCP Connection Management (cont),TCP server lifecycle,Chapter 3 outline,3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection manageme
38、nt 3.6 Principles of congestion control 3.7 TCP congestion control,3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer rdt Model GBN(Go Back N) SR(Selective Repeat ),Principles of Congestion Control,Congestion: informally: “too many sources sending too much data too fast for netwo
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 营销团队激励与绩效考核方案模板
- 妊娠期高血压的循证护理实践
- 金融服务信誉与稳定承诺函(6篇)
- 环保义务责任履行承诺书(5篇)
- 食道癌护理案例分析
- 护理不良事件报告的绩效评估
- 颅骨损伤患者鼻饲护理要点
- 小学议论文:学校开展体育活动的意义9篇
- 绿色技术协作承诺书5篇
- 天际凤凰岛两栖生活方式新闻策划方案
- 2025年核科学与技术核物理真题试卷(含答案)
- 空压机产品标准化设计方案
- 债务优化服务合同范本
- 胸腔穿刺知识培训课件
- 2025年公司代收款委托书(委托第三方代收款协议书范本)
- 家庭宽带网络知识培训课件
- 智慧树知道网课《幸福家庭建设》课后章节测试满分答案
- 明朝内阁制度解读
- 索尼摄像机HDR-CX180E说明书
- 索尼黑卡5说明书
- 智慧树知道网课《创业十步》课后章节测试答案
评论
0/150
提交评论