




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、The Transport Layer傳輸層Chapter 62022/7/251The Transport LayerThe task of the transport layer:To provide efficient, reliable, cost-effective data transport from source machine to the destination machine傳輸層的任務:為源端到目的端提供可靠、價格合理的數(shù)據(jù)傳輸26.1 The Transport ServiceServices Provided to the Upper LayersTransport
2、 Service PrimitivesBerkeley SocketsAn Example of Socket Programming: An Internet File Server36.1.1 Services Provided to the Upper LayersThe network, transport, and application layers.4Services Provided to the Upper Layers(2)最終目標為用戶(應用進程)提供有效、可靠、價格合理的服務網(wǎng)絡層、傳輸層和應用層傳輸服務類型:面向連接, 三個階段:建立連接、數(shù)據(jù)傳輸和釋放連接無連接OS
3、I模型劃分為2大部分:1-4層:傳輸服務提供者(Transport service provider)5-7層:傳輸服務用戶(Transport service user)56.1.2 Transport Service PrimitivesThe primitives for a simple transport service.傳輸服務與網(wǎng)絡服務的區(qū)別網(wǎng)絡服務不太可靠,而面向連接的傳輸服務則是可靠的服務對象不同網(wǎng)絡層的數(shù)據(jù)交換比傳輸層復雜的多一個簡單傳輸服務的原語: 6Transport Service Primitives (2)The nesting of TPDUs, packets
4、, and frames.傳輸協(xié)議數(shù)據(jù)TPDUTPDU,分組和幀的嵌套:7Transport Service Primitives (3)A state diagram for a simple connection management scheme. Transitions labeled in italics are caused by packet arrivals. The solid lines show the clients state sequence. The dashed lines show the servers state sequence. Disconnecti
5、on AsymmetricSymmetric86.1.3 Berkeley SocketsThe socket primitives for TCP. (注意這些系統(tǒng)調(diào)用所使用的參數(shù))96.1.4 Socket Programming Example:Internet File ServerClient code using sockets.6-6-110Socket Programming Example:Internet File Server (2)Server code using sockets.116.2 Elements of Transport ProtocolsAddress
6、ingConnection EstablishmentConnection ReleaseFlow Control and BufferingMultiplexingCrash Recovery12Transport Protocol(a) Environment of the data link layer.(b) Environment of the transport layer.13Transport Protocol與數(shù)據(jù)鏈路層的差異兩者都要解決:差錯控制、分組順序、流量控制等問題路由、目的地址連接建立過程子網(wǎng)的存儲能力(數(shù)據(jù)緩沖、流量控制)數(shù)量上的差別146.2.1 Address
7、ingTSAPs, NSAPs and transport connections.Ports:end pointsTSAP:Transport Service Access PointNSAP:15Addressing(2)Name Server(Directory Server):用于查找TSAP地址地址空間層次型地址地址=如: +86,571,7952114平面型地址通過二級映射(如 DNS服務器)來定位機器166.2.2 Connection EstablishmentHow a user process in host 1 establishes a connection with
8、a time-of-day server in host 2.17Connection Establishment (2)一個復雜的過程:延遲的重復分組的干擾解決方法:廢棄使用過的傳輸?shù)刂方o每個連接分配一個連接標識符缺陷:每個傳輸實體長時間保存歷史信息。如果系統(tǒng)崩潰,將造成信息丟失改進技術(shù),刪除在子網(wǎng)中“徘徊”的過時分組:將分組的生命周期限制在一個已知的最大值內(nèi):受限制的子網(wǎng)設計在每個分組內(nèi)設計一個站段計數(shù)器為每個分組加上時間標記18Connection Establishment (3)(a) TPDUs may not enter the forbidden region.(b) The
9、resynchronization problem.基本思想:確保在同一時刻永遠不會出現(xiàn)兩個相同編號的TPDU19Connection Establishment (4)Three protocol scenarios for establishing a connection using a three-way handshake. CR denotes CONNECTION REQUEST. (a) Normal operation, (b) Old CONNECTION REQUEST appearing out of nowhere. (c) Duplicate CONNECTION
10、REQUEST and duplicate ACK.206.2.3 Connection ReleaseAbrupt disconnection with loss of data.終止連接的兩種方法:非對稱釋放-可能導致丟失數(shù)據(jù)-see fig 6-12對稱釋放 適用于固定數(shù)量的數(shù)據(jù)發(fā)送,且知道何時完畢21Connection Release (2)The two-army problem:無論三次、四次的握手都不能圓滿地解決問題22Connection Release (3)實際應用,三次握手-see fig 6-14并非絕對無誤,但卻令人滿意三次握手的不足:第一個DR和所有N次的重發(fā),最
11、終造成半連通的連接 協(xié)議失敗消除半連通的辦法:在一段時間內(nèi)沒有受到任何TPDU,便自動釋放連接23Connection Release (4)Four protocol scenarios for releasing a connection. (a) Normal case of a three-way handshake. (b) final ACK lost.6-14, a, b24Connection Release (5)(c) Response lost. (d) Response lost and subsequent DRs lost.256.2.4 Flow Control
12、and Buffering*考慮連接在使用過程中的管理問題通過滑動窗口和其它機制數(shù)據(jù)緩沖的方法: -see fig 6-15固定大小可變大小循環(huán)緩沖區(qū)另一個可能的瓶頸:子網(wǎng)的運載容量26Flow Control and Buffering(2)(a) Chained fixed-size buffers. (b) Chained variable-sized buffers. (c) One large circular buffer per connection.27Flow Control and Buffering (3)Dynamic buffer allocation. The ar
13、rows show the direction of transmission. An ellipsis () indicates a lost TPDU.286.2.5 Multiplexing * (a) Upward multiplexing:考慮連接的費用問題 (b) Downward multiplexing:考慮連接的技術(shù)(帶寬、可靠性)問題,以提高連接的帶寬296.2.6 Crash Recovery *從網(wǎng)絡和路由器中恢復如果網(wǎng)絡層提供數(shù)據(jù)報服務,傳輸實體留有丟失的TPDU的副本如果網(wǎng)絡層提供面向連接的服務,重建新的虛電路,重發(fā)丟失的TPDU從主機或服務器崩潰中恢復,存在著復雜
14、的問題-see fig 6-18結(jié)論:從第N層崩潰中恢復只能由第N+1層來完成,并且只能由第N+1層留有足夠狀態(tài)信息的情況下才能完成30Crash Recovery(2)Different combinations of client and server strategy.A:Acknowledgement, W: writing to the output process, C: crashing316.3 A Simple Transport Protocol *The Example Service PrimitivesThe Example Transport EntityThe E
15、xample as a Finite State Machine326.3.1 The Example Service Primitives5條原語Connum = LISTEN(local)Connum = CONNECT(local,remote)Status = SEND(connum,buffer,bytes)Status = RECEIVE(connum,buffer,bytes)Status = DISCONNECT(connum)336.3.2 The Example Transport EntityThe network layer packets used in our ex
16、ample.選用面向連接的網(wǎng)絡服務與網(wǎng)絡層的接口:to_net 和 from_net網(wǎng)絡層分組類型-see fig 6-19網(wǎng)絡層通過 enable_transport_layer 和 disable_transport_layer控制傳輸層對其調(diào)用34The Example Transport Entity (2)Each connection is in one of seven states:IDLE Connection not established yet.WAITING CONNECT has been executed, CALL REQUEST sent.QUEUED A C
17、ALL REQUEST has arrived; no LISTEN yet.ESTABLISHED The connection has been established.SENDING The user is waiting for permission to send a packet.RECEIVING A RECEIVE has been done.DISCONNECTING a DISCONNECT has been done locally.Main data structure: conn35The Example Transport Entity (3)36The Examp
18、le Transport Entity (4)37The Example Transport Entity (5)38The Example Transport Entity (6)39信用報文 (Credit Message)40The Example Transport Entity (8)41The Example Transport Entity (9)42The Example Transport Entity (10)436.3.3 The Example as a Finite State Machine(*)The example protocol as a finite st
19、ate machine. Each entry has an optional predicate, an optional action, and the new state. The tilde indicates that no major action is taken. An overbar above a predicate indicate the negation of the predicate. Blank entries correspond to impossible or invalid events.44The Example as a Finite State M
20、achine (2)The example protocol in graphical form. Transitions that leave the connection state unchanged have been omitted for simplicity.456.4 The Internet Transport Protocols: UDPIntroduction to UDPRemote Procedure CallThe Real-Time Transport Protocol466.4.1 Introduction to UDPThe UDP header.無連接的傳輸
21、協(xié)議UDP(User Data Protocol)發(fā)送封裝的原始IP數(shù)據(jù)報發(fā)送時無需建立連接UDP數(shù)據(jù)段包括:8字節(jié)頭+數(shù)據(jù)部分頭格式-see fig 6-23476.4.2 Remote Procedure CallSteps in making a remote procedure call. The stubs are shaded. 486.4.3The Real-Time Transport ProtocolReal-time multimedia applications:Internet radioInternet telephony Music-on-demandVideoco
22、nferencingVideo-on-demandBasic function of RTP: Multiplex several real-time data streams onto a single stream of UDP packetsNo flow control, no error control, no acknowledgement and no retransmissionsTimestamping: to make multi-streams play back sychronously49The Real-Time Transport Protocol(2)(a) T
23、he position of RTP in the protocol stack. (b) Packet nesting.50The Real-Time Transport Protocol (3)The RTP header.51The Real-Time Transport Protocol (4)RTCP (Realtime Transport Control Protocol)Handle feedback, synchronization526.5 The Internet Transport Protocols: TCPIntroduction to TCPThe TCP Serv
24、ice ModelThe TCP ProtocolThe TCP Segment HeaderTCP Connection EstablishmentTCP Connection ReleaseTCP Connection Management ModelingTCP Transmission PolicyTCP Congestion ControlTCP Timer ManagementWireless TCP and UDPTransactional TCP536.5.1 Introduction to TCPTCPTransmission Control ProtocolProvide
25、a reliable end-to-end byte stream over an unreliable internetworkConnection-oriented Defined in RFC 793, 1122,1323Segment 64KB546.5.2 The TCP Service Model套接字(socket)地址:IP地址+端口(port, 16bits)Well-known port(通用端口)Port number 1024FTP: 21, Telnet: 23, SMTP: 25 TCP連接: 全雙工、點到點、不支持廣播、字節(jié)流TCP數(shù)據(jù)的緩存發(fā)送和立即發(fā)送(帶PU
26、SH標志)緊急數(shù)據(jù)帶URGENT標志55The TCP Service Model(2)Some assigned ports.記住常用的端口號!PortProtocolUse21FTPFile transfer23TelnetRemote login25SMTPE-mail69TFTPTrivial File Transfer Protocol79FingerLookup info about a user80HTTPWorld Wide Web110POP-3Remote e-mail access119NNTPUSENET news56The TCP Service Model (3)(
27、a) Four 512-byte segments sent as separate IP datagrams.(b) The 2048 bytes of data delivered to the application in a single READ CALL.576.5.4 The TCP Segment Header數(shù)據(jù)交換形式:數(shù)據(jù)段(segment)包含:20字節(jié)頭+大小限制:Segment max size (65515 字節(jié) and MTU)65535-20(IP Header)-20(TCP Header) = 65495 payloadTCP基本協(xié)議:滑動窗口協(xié)議盡管協(xié)議
28、簡單、但要解決許多問題58The TCP Segment HeaderTCP Header.59The TCP Segment Header (2)Source port / Destination portSequence number Acknowledgment number The next byte expected, not the last byte correctly receivedHeader lengthHow many 32-bit wordsURG =1: Urgent pointer is in useACK =1: Acknowledgment number is
29、 validPSH =1: deliver the data to the application layer upon arrivalRST =1: to reset a connectionSYN =1: to establish a connectionSYN=1, ACK=0: CONNECTION REQUESTSYN=1, ACK=1: CONNECTION ACCEPTEDFIN =1: to release a connection60The TCP Segment Header (3)ChecksumInclude: Header, Data and Pseudoheader
30、The pseudoheader included in the TCP checksum.61The TCP Segment Header (4)OptionMaximum TCP payload willing to acceptDefault 536 bytes TCP segment:536+20=556Selective repeat transmission (instead of go back n protocol) Option: Windows scaleWindow sizeTells how many bytes (octets) may be sent626.5.5
31、TCP Connection Establishment(a) TCP connection establishment in the normal case.(b) Call collision.6-3163TCP Connection Establishment(2)建立連接:采用三次握手的方法服務器:執(zhí)行LISTEN和ACCEPT原語客戶端:執(zhí)行CONNECT原語(SYN=1, ACK=0)兩主機同時想在相同的套接字間建立連接,造成碰撞646.5.6 TCP Connection ReleaseThink of connections as a pair of simplex conne
32、ctionsEach simplex connection is released independently of its siblingWhen the FIN is acknowledged, that direction is shut down for new dataTo avoid two-army problem, timers are used 656.5.7 TCP Connection Management ModelingThe states used in the TCP connection management finite state machine.66TCP
33、 Connection Management Modeling (2)Event/actionEvent: A user-initiated system call( CONNECTION, LISTEN, SEND, CLOSE)A segment arrival(SYN, FIN, ACK, or RST)A case: a timeout of twice the maximum packet lifetimeAction:The sending of a control segment (SYN,FIN or RST)Nothing (-)67TCP Connection Manage
34、ment Modeling (3)TCP connection management finite state machine. The heavy solid line is the normal path for a client. The heavy dashed line is the normal path for a server. The light lines are unusual events. Each transition is labeled by the event causing it and the action resulting from it, separ
35、ated by a slash.(event/action)68TCP Connection Management Modeling (4)Event/Action (Comments)Event : a user initiated system call (CONNECT, LISTEN, SEND, or CLOSE)A segment arrival (SYN,FIN, ACK, or RST)A timeout of twice the maximum packet lifetimeAction: The sending of a control segment (SYN,FIN,
36、or RST) Nothing (indicated by “-”)69TCP Connection Management Modeling (5)分析:沿客戶端的路徑(粗實線)客戶端應用發(fā)出CONNECT請求,本地TCP實體創(chuàng)建一個連接記錄, 然后發(fā)送SYN數(shù)據(jù)段到服務器端 CONNECT/SYN (第一次握手) ,并標記為SYN SENT狀態(tài)當SYN+ACK (SYN=1,ACK=1)數(shù)據(jù)段到達后, TCP實體發(fā)出最后一個ACK數(shù)據(jù)段SYN+ACK/ACK (第三次握手), 狀態(tài)進入ESTABLISHED. 現(xiàn)在可開始數(shù)據(jù)發(fā)送和接收了.完成數(shù)據(jù)收發(fā)任務后, 客戶端執(zhí)行CLOSE原語, 使當
37、地TCP實體發(fā)送出FIN數(shù)據(jù)段CLOSE/FIN,并等待相應的ACK數(shù)據(jù)段(主動關(guān)閉),進入FIN WAIT1狀態(tài)ACK到達后ACK/-,轉(zhuǎn)移到FIN WAIT2狀態(tài), 連接在一個方向上斷開了.另一方面也需要斷開連接時,會發(fā)出FIN數(shù)據(jù)段,并得ACK確認FIN/ACK. 現(xiàn)在雙方均已斷開連接.TCP需要等待一個最大的分組生命期,確保該連接的所有分組全部消失(TIMED WAIT), 防止出現(xiàn)確認丟失, 此時已沒有任何Event/Action了-/-當定時器超時后,進入CLOSED狀態(tài),TCP刪除該連接記錄, 回到起始70TCP Connection Management Modeling (6
38、)分析:沿服務端的路徑(粗虛線)服務器執(zhí)行LISTEN原語,并等待連接請求到來LISTEN/-. 狀態(tài):LISTEN一個SYN數(shù)據(jù)段到達后,將被確認 SYN/SYN+ACK(第二次握手),并且服務器進入SYN REVD狀態(tài)當服務器發(fā)出的SYN也被確認ACK/-后,三次握手便完成了, 服務器進入ESTABLISHED狀態(tài), 現(xiàn)在可開始數(shù)據(jù)發(fā)送和接收了.客戶端完成數(shù)據(jù)發(fā)送任務后,執(zhí)行CLOSE原語, 發(fā)送一個FIN數(shù)據(jù)段到達服務器端. (被動關(guān)閉).服務器給出響應FIN/ACK后, 便進入CLOSE WAIT狀態(tài).服務器也執(zhí)行CLOSE原語, 向客戶端發(fā)出一個FIN CLOSE/FIN,進入LAS
39、T ACK狀態(tài)收到客戶端的確認后ACK/-,服務期便釋放該連接, 進入CLSOED狀態(tài),刪除連接記錄716.5.8 TCP Transmission PolicyWindow management in TCP.通常,當滑動窗口win=0時,停止發(fā)送但有例外:Urgent data數(shù)據(jù)傳輸?shù)淖顗那闆r:Telnet每個輸入字符需要162字節(jié)帶寬并發(fā)送4個數(shù)據(jù)段72TCP Transmission Policy (2)Nagles algorithm:When data come into the sender one byte at a time, just send the first byt
40、e and buffer all the rest until the outstanding byte is acknowledgeTry to solve the problem caused by the sender delivering data to a byte at a time 73TCP Transmission Policy (3)Silly window syndrome(傻瓜窗口癥狀).74TCP Transmission Policy (4)Clark Solution (for silly window syndrome)Forced to wait until
41、it has a decent amount of space available and advertise that to senderTo solve the problem of the receiving application sucking the data up from TCP a byte at a time 756.5.9 TCP Congestion Control(a) A fast network feeding a low capacity receiver.(b) A slow network feeding a high-capacity receiver.7
42、6TCP Congestion Control (2)兩個潛在的問題:網(wǎng)絡的容量接收方的容量發(fā)送方需要保持的兩個窗口:接收方承認的窗口擁塞窗口(Congestion Window)取上面兩個基本點窗口的最小值作為可發(fā)送字節(jié)數(shù)擁塞窗口大小的獲?。翰捎寐賳樱╯low start)算法77TCP Congestion Control (3)An example of the Internet congestion algorithm.(congestion window size start from 1024bytes)786.5.10 TCP Timer Management重發(fā)定時器(Re
43、transmission Timer)超時間隔如何確定?數(shù)據(jù)鏈路層vs TCP中確認到達時間的概率超時時間間隔太短(T1)或太長(T2)都有問題79TCP Timer Management(2)(a) Probability density of ACK arrival times in the data link layer. (b) Probability density of ACK arrival times for TCP.80TCP Timer Management(3)解決辦法:通過對網(wǎng)絡性能的不斷測定,采用一種不斷調(diào)整超時時間間隔的動態(tài)算法(Jacobson,1988)原理:R
44、TT = RTT+(1-)M D = D + (1- )|RTT-M|超時值 = RTT + 4*D其中:M響應(ACK)時間, smoothing factor RTTRetransmission Timer簡單建議:已重發(fā)的數(shù)據(jù)段無需修正其RTT,而是在失敗后將超時時間加倍,直到傳輸成功。-(Karm算法)81TCP Timer Management(4)持續(xù)定時器(Persistence Timer)防止出現(xiàn)死鎖“?;睢倍〞r器(Keepalive Timer)超時后檢測對方是否仍然存在TIMED WAIT定時器設定為分組最長生命周期的兩倍確保釋放連接創(chuàng)建時申請的所有資源826.5.11
45、Wireless TCP and UDP原有的TCP實現(xiàn)都基于有線網(wǎng),在無線網(wǎng)上可能性能極差主要問題:擁塞控制算法有線網(wǎng):分組丟失時,放慢發(fā)送速度無線網(wǎng):分組丟失時,盡快重發(fā)分組83Wireless TCP and UDP(2)解決辦法:采用“間接TCP”將一個TCP連接分為兩個連接-see fig 6-39優(yōu)點:兩個連接均為同質(zhì)缺點:不符合TCP的定義對無線網(wǎng)上的UDP同樣需要制定一套確保盡量可靠的解決方案84Wireless TCP and UDP(3)Splitting a TCP connection into two connections.856.5.12 Transactiona
46、l TCP(a) RPC using normal TCP.(b) RPC using T/TCP.86Transactional TCP(2)Clients first packet contains:SYN bitRequest FIN“I want to establish a connection, here is the data and I am done.”Server:Get the requestLook up or compute to form a replyFIN“I acknowledge your FIN, here is the answer, and I am
47、done”876.6 Performance Issues *Performance Problems in Computer NetworksNetwork Performance MeasurementSystem Design for Better PerformanceFast TPDU ProcessingProtocols for Gigabit Networks88Performance Issues(2)性能問題的復雜性性能下降卻不知道為什么了解性能更像一門藝術(shù),而不是一門科學涉及:網(wǎng)路層、傳輸層等術(shù)語“段”(segment) 傳輸層“分組”(packet) - 網(wǎng)絡層“報文”
48、(message) - 應用層“幀”(frame) 數(shù)據(jù)鏈路層896.6.1 Performance Problems in Computer Networks擁塞資源組織不合理過載, 廣播風暴(broadcast storm)UDP遭受廣播風暴解決方法:主機不對廣播方式的UDP錯報做出響應適當?shù)卦O置超時時限電源故障 RARP請求千兆級網(wǎng)絡上使用原有協(xié)議-see fig 6-41帶寬延遲乘積(bandwidth-delay product)結(jié)論:若想得到好的性能,接收窗口大小必須大于等于帶寬延遲乘積。因為接收方不會馬上作出響應90Performance Problems in Computer
49、 NetworksThe state of transmitting one megabit from San Diego to Boston(a) At t = 0, (b) After 500 sec, (c) After 20 msec, (d) after 40 msec.916.6.2 Network Performance MeasurementThe basic loop for improving network performance.Measure relevant network parameters, performance.Try to understand what is going on.Change one parameter.92Network Performance Measurement(2)改善性能的基本步驟(循環(huán)):測定相關(guān)的網(wǎng)絡參數(shù)和性能盡
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 己亥雜詩 教學課件
- 六年級英語口語教學課件
- 暖通工程效益分析報告
- 散文閱讀課件
- 墻的教學課件
- 題型04 物質(zhì)性質(zhì)的探究-備戰(zhàn)2020年中考化學實驗題型特訓(原卷版)
- 日常書寫展示活動方案
- 【鄭州】2025年河南建筑職業(yè)技術(shù)學院招聘工作人員30人筆試歷年典型考題及考點剖析附帶答案詳解
- 新建醫(yī)院活動方案
- 星光課堂活動方案
- 2025至2030中國柔性直流輸電行業(yè)運營規(guī)劃及發(fā)展前景深度分析報告
- 安全產(chǎn)風險管理制度
- 2025高考全國一卷語文真題
- GB/T 1094.1-2013電力變壓器第1部分:總則
- 檢驗科工作人員健康管理制度(4篇)
- 簡潔風格微立體圖表圖標關(guān)系動態(tài)素材課件
- 超級經(jīng)典的SYB游戲模塊一規(guī)則、流程和演練課件
- 一級(含)以下醫(yī)療機構(gòu)醫(yī)學檢驗科準入現(xiàn)場驗收表
- 七年級下學期暑假家長會課件
- 整形美容??撇v
- DB33T 1199-2020 農(nóng)村生活污水處理設施建設和改造技術(shù)規(guī)程
評論
0/150
提交評論