《山东大学计算机网络英语课件06Transport Layer》由会员分享,可在线阅读,更多相关《山东大学计算机网络英语课件06Transport Layer(77页珍藏版)》请在金锄头文库上搜索。
1、Transport LayerChapter 6CN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011Transport ServiceElements of Transport ProtocolsCongestion ControlInternet Protocols UDP Internet Protocols TCP Performance IssuesDelay-Tolerant NetworkingRevised: August 2011The Transport La
2、yerCN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011Responsible for delivering data across networks with the desired reliability or qualityPhysicalLinkNetworkTransportApplicationTransport ServiceCN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D.
3、 Wetherall, 2011Services Provided to the Upper Layer Transport Service Primitives Berkeley Sockets Socket Example: Internet File Server Services Provided to the Upper Layers (1)Transport layer adds reliability to the network layerOffers connectionless (e.g., UDP) and connection-oriented (e.g, TCP) s
4、ervice to applications CN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011Services Provided to the Upper Layers (2)CN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011Transport layer sends segments in packets (in frames)SegmentSegmen
5、tTransport Service Primitives (1)CN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011Primitives that applications might call to transport data for a simple connection-oriented service:Client calls CONNECT, SEND, RECEIVE, DISCONNECTServer calls LISTEN, RECEIVE, SEND,
6、DISCONNECTSegmentTransport Service Primitives (2)CN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011State diagram for a simple connection-oriented serviceSolid lines (right) show client state sequenceDashed lines (left) show server state sequenceTransitions in itali
7、cs are due to segment arrivals. Berkeley SocketsCN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011Very widely used primitives started with TCP on UNIXNotion of “sockets” as transport endpointsLike simple set plus SOCKET, BIND, and ACCEPTSocket Example Internet File
8、 Server (1)CN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011. . .Get servers IP addressMake a socketTry to connectClient code . . .Socket Example Internet File Server (2)CN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011Client co
9、de (cont.) . . .Loop reading (equivalent to receive) until no more data; exit implicitly calls closeWrite data (equivalent to send)Socket Example Internet File Server (3)CN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011. . .Server code . . .Make a socketAssign add
10、ress Prepare for incoming connectionsSocket Example Internet File Server (4)CN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011Server code . . .Block waiting for the next connectionRead (receive) request and treat as file name Write (send) all file dataDone, so clos
11、e this connectionElements of Transport ProtocolsCN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011Addressing Connection establishment Connection release Error control and flow control Multiplexing Crash recovery AddressingCN5E by Tanenbaum & Wetherall, Pearson Educ
12、ation-Prentice Hall and D. Wetherall, 2011Transport layer adds TSAPsMultiple clients and servers can run on a host with a single network (IP) addressTSAPs are ports for TCP/UDPConnection Establishment (1)CN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011Key problem
13、 is to ensure reliability even though packets may be lost, corrupted, delayed, and duplicatedDont treat an old or duplicate packet as new(Use ARQ and checksums for loss/corruption) Approach:Dont reuse sequence numbers within twice the MSL (Maximum Segment Lifetime) of 2T=240 secsThree-way handshake
14、for establishing connection Connection Establishment (2)CN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011Use a sequence number space large enough that it will not wrap, even when sending at full rateClock (high bits) advances & keeps state over crashNeed seq. numb
15、er not to wrap within T secondsNeed seq. number not to climb too slowly for too longConnection Establishment (3)CN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011Three-way handshake used for initial packetSince no state from previous connectionBoth hosts contribute
16、 fresh seq. numbersCR = Connect RequestConnection Establishment (4)CN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011Three-way handshake protects against odd cases:a)Duplicate CR. Spurious ACK does not connectb)Duplicate CR and DATA. Same plus DATA will be rejected (wrong ACK).a)b)XXXConnection Release (1)CN5E by Tanenbaum & Wetherall, Pearson Education-Prentice Hall and D. Wetherall, 2011Key problem is to ensure reliability while releasingAsymmetric release (w