通信网络技术课件:chapter6 The Transport Layer_第1页
通信网络技术课件:chapter6 The Transport Layer_第2页
通信网络技术课件:chapter6 The Transport Layer_第3页
通信网络技术课件:chapter6 The Transport Layer_第4页
通信网络技术课件:chapter6 The Transport Layer_第5页
已阅读5页,还剩154页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Computer NetworksRoadmapIntroductionPhysical LayerData Link LayerTransport LayerNetwork LayerMedium Access SublayerApplication LayerThe Transport LayerChapter 6What you will learn in this Chapter6.1 The Transport Service6.2 Elements of Transport Protocols6.3 A Simple Transport Protocol6.4 The Intern

2、et Transport Protocols: UDP6.5 The Internet Transport Protocols: TCP6.6 Performance IssuesTo provide reliable, cost-effective data transport from the source machine to the destination machine, independently of the physical network or networks currently in use. 6.1 The Transport ServiceServices Provi

3、ded to the Upper LayersTransport Service PrimitivesBerkeley SocketsAn Example of Socket Programming: An Internet File ServerServices Provided to the Upper LayersThe network, transport, and application layers.Logical End-to-End TransportProvide logical communication between app processes running on d

4、ifferent hostsapplicationtransportnetworkdata linkphysicalapplicationtransportnetworkdata linkphysicalnetworkdata linkphysicalnetworkdata linkphysicalnetworkdata linkphysicalnetworkdata linkphysicalnetworkdata linkphysicallogical end-end transportServices Provided to the Upper LayersThe ultimate goa

5、l of the transport layerProvide efficient, reliable, and cost-effective service to its users, normally processes in the application layer Transport entityTo achieve this goal, the transport layer makes use of the services provided by the network layer. The hardware and/or software within the transpo

6、rt layer that does the work is called the transport entity. The transport entity can be located in the operating system kernel, in a separate user process, in a library package bound into network applications, or conceivably on the network interface card. Services Provided to the Upper LayersTwo typ

7、e of transport service as network serviceThe connection-oriented transport service three phases: establishment, data transfer, and release. Addressing and flow control The connectionless transport service Why Similar service but two distinct LayersThe transport code runs entirely on the users machin

8、es the network layer mostly runs on the routers, which are operated by the carrier Problems with network serviceNetwork Layer (NL) provides “Best Effort” service: NL will “attempt” to deliver a segment to the requested destination, but makes no guarantyTo guaranty delivery, keep sending and ask for

9、acknowledgment (ACKs themselves are delivered via “Best Effort”)Best Effort leaves a lot to be desired:segments can be delayed, lost, reordered (with respect to other transmitted packets)sender and receiver flow capabilities can be mismatched (e.g., sender can send packets faster than receiver can b

10、uffer)high transmission rates can induce network congestion doesnt (want to know) which transport-layer segments belong to which messageThe Transport Servicethe existence of the transport layer makes it possible for the transport service to be more reliable than the underlying network service Lost p

11、ackets and mangled data can be detected and compensated for by the transport layer. the transport service primitives can be implemented as calls to library procedures in order to make them independent of the network service primitives. By hiding the network service behind a set of transport service

12、primitives, changing the network service merely requires replacing one set of library procedures by another one that does the same thing with a different underlying service. Distinction between the transport and lower layersThe bottom four layers can be seen as the transport service provider, wherea

13、s the upper layer(s) are the transport service user.User Oriented. Application programmers interact directly with the transport layer; from the programmers perspective, the transport layer is the network. The transport layer should be oriented more towards user services. Should not simply reflect wh

14、at the underlying layers happen to provide. Provides an API.Transport Service PrimitivesTransport Service Primitives are a minimum set of user-Transport Layer interfaces to allow users to access the transport service.Network Service vs. Transport ServiceReliabilitythe network service is intended to

15、model the service offered by real networks, warts and all. Real networks can lose packets, so the network service is generally unreliable. The (connection-oriented) transport service, in contrast, is reliable. Of course, real networks are not error-free, but that is precisely the purpose of the tran

16、sport layerto provide a reliable service on top of an unreliable network. Network Service vs. Transport ServiceIntended UserThe network service is used only by the transport entities. Few users write their own transport entities, and thus few users or programs ever see the bare network service. In c

17、ontrast, many programs (and thus programmers) see the transport primitives. Consequently, the transport service must be convenient and easy to use. Transport Service PrimitivesThe primitives for a simple transport service.A Client / Server applicationthe server executes a LISTEN primitive When a cli

18、ent wants to talk to the server, it executes a CONNECT primitive. server sends a CONNECTION ACCEPTED TPDU back to the client, and the connection is established . Data can now be exchanged using the SEND and RECEIVE primitives When a connection is no longer needed, it must be released to free up tabl

19、e space within the two transport entities by issuing a DISCONNECT primitive . TPDU (Transport Protocol Data Unit) The nesting of TPDUs, packets, and frames.The Complication behindAt the transport layer, even a simple unidirectional data exchange is more complicated than at the network layer. Every d

20、ata packet sent will also be acknowledged (eventually). The packets bearing control TPDUs are also acknowledged, implicitly or explicitly. These acknowledgements are managed by the transport entities, using the network layer protocol, and are not visible to the transport users. Similarly, the transp

21、ort entities will need to worry about timers and retransmissions. None of this machinery is visible to the transport users. To the transport users, a connection is a reliable bit pipe: one user stuffs bits in and they magically appear at the other end. Transport Service PrimitivesA state diagram for

22、 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. Berkeley SocketsThe socket primitives for TCP.Socket Programming Example:Internet File ServerClient

23、 code using sockets.6-6-1Socket Programming Example:Internet File Server (2)Server code using sockets.6.2 Elements of Transport ProtocolsAddressingConnection EstablishmentConnection ReleaseFlow Control and BufferingMultiplexingCrash RecoveryTransport Protocol(a) Environment of the data link layer.(b

24、) Environment of the transport layer.Difference between DLL and Transport LayerPROPERTYDATA LINK LAYER TRANSPORT LAYERROUTINGOver Physical ChannelOver Entire Subnet ADDRESSINGDestination router determined by outgoing lineExplicit addresses requiredINITIAL CONNECTIONOther end is always thereMany comp

25、licated possibilitiesSTORAGE CAPACITYPacket either arrives or doesntPacket may bounce around for a long while.BUFFERINGConcerned with only one connectionMust support many connectionsThe entity that implements the Transport Layer performs many of the same functions as does the Data Link Layer. But th

26、ere are some essential differences:AddressingTransport AddressWhen an application (e.g., a user) process wishes to set up a connection to a remote application process, it must specify which one to connect to. TSAP ( Transport Service Access Point ) in the transport layer NSAP ( Network Service Acces

27、s Point ) in the network layerIn the Internet, this corresponds to an (IP address, local port) pair. AddressingTSAPs, NSAPs and transport connections.Transport ConnectionA time of day server process on host 2 attaches itself to TSAP 1522 to wait for an incoming call. How a process attaches itself to

28、 a TSAP is outside the networking model and depends entirely on the local operating system. A call such as our LISTEN might be used, for example.An application process on host 1 wants to find out the time-of-day, so it issues a CONNECT request specifying TSAP 1208 as the source and TSAP 1522 as the

29、destination. This action ultimately results in a transport connection being established between the application process on host 1 and server 1 on host 2.The application process then sends over a request for the time.The time server process responds with the current time.The transport connection is t

30、hen released.Get known of the ServicesThere are four (at least!) methods for determining the location of a remote service:That service has advertised globally that it is on a particular port. Its been on this port for years! FTP is port 21.It advertises its service locally - once you get to that mac

31、hine, you can find its service name in /host/services or the network equivalent of this. getservbyname().A process server (inetd in the Internet) watches for a connection requesting a particular service. Upon a request, it spawns a process to provide the service.A local name server has handled regis

32、tration of services. A process requesting a connection can ask this name server for the port of the service. Connection EstablishmentHow a user process in host 1 establishes a connection with a time-of-day server in host 2.Connection ProblemsIf all goes well, one transport entity to just send a CONN

33、ECTION REQUEST TPDU to the destination and wait for a CONNECTION ACCEPTED reply, establishing a connection is easy. BUT, problems occur when the network can lose, store, and duplicate packets. - duplicated is the REAL problem.Delayed Duplicates.Imagine a subnet that is so congested that acknowledgem

34、ents hardly ever get back in time and each packet times out and is retransmitted two or three times. Suppose that the subnet uses datagrams inside and that every packet follows a different route. Some of the packets might get stuck in a traffic jam inside the subnet and take a long time to arrive, t

35、hat is, they are stored in the subnet and pop out much later. The worst caseImagine this scenario:A connection is established, A transaction performed and The connection closed. (Unfortunately, each packet in the scenario is duplicated and stored in the subnet)After the connection released, Various

36、duplicate frames arrive in order and do the whole thing again.TacksWays to avoid this include:Use a different transport address each time; but then well-known ports will no longer work.Use a sequence number (id) for each connection. When a connection is closed, the server updates a number representi

37、ng the next-expected connection. But this requires state in every server about every connection its ever gotten. Such state wont survive across a crash.TacksWays to avoid this include:Devise a way to kill off aged packets; ensure that no packet can survive longer than some known time. Ways of doing

38、this include:Restricted subnet design: Prevent packets from looping; limit the time used by congestion delay.Use a hop count: throw away any packet thats been forwarded more than N times.Time stamp packets: Routers compare current time against time of creation of the packet and discard aged packets

39、greater than time T. (Requires clock synchronization.) We also need to ensure that ACKs of these packets are also gone; do this by waiting some multiple of T.Tomlinson method (1975)Sunshine and Dalal (1978)A foolproof way to establish connections safely with packet lifetimes boundedEach machine has

40、a clock to get round the problem of a machine losing all memory of where it was after a crash.Time survives even across system crashes. The clocks dont need synchronization but need granularity finer than the sequence numbers in the packets.No identically numbered packets will be outstanding at the

41、same time as a result of a restart; this can be assured by using a large sequence number space.Connection Establishment (a) TPDUs may not enter the forbidden region.(b) The resynchronization problem.Establishing a connectionThe clock-based method solves the delayed duplicate problem for data TPDUs,

42、but for this method to be useful, a connection must first be established.Since control TPDUs may also be delayed, there is a potential problem in getting both sides to agree on the initial sequence number.the three-way handshake. Many connection problems can be solved with the Three Way Handshake.No

43、te the use of sequence numbers for all requests. Each host attaches its own sequence number and ACKs the sequence number of the request it just received. Here the possible frame types are CR (Connection Request), ACK, DATA,REJECT.Well see Three Way Handshake again as used by TCP.the three-way handsh

44、ake.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 REQUEST and duplicate ACK.Normal 3 stepsThe normal setup procedure when host 1 in

45、itiates Host 1 chooses a sequence number, x, and sends a CONNECTION REQUEST TPDU containing it to host 2.Host 2 replies with an ACK TPDU acknowledging x and announcing its own initial sequence number, y. Finally, host 1 acknowledges host 2s choice of an initial sequence number in the first data TPDU

46、 that it sends. Connection Release Two styles of terminating a connection:Asymmetric Release Asymmetric release is the way the telephone system works: when one party hangs up, the connection is broken. Symmetric Release.Symmetric release treats the connection as two separate unidirectional connectio

47、ns and requires each one to be released separately. Potential Problems with Asymmetric ReleaseAbrupt disconnection with loss of data.Potential Problems with Asymmetric ReleaseAsymmetric release is abrupt and may result in data loss. Consider the scenario last page. After the connection is establishe

48、d, host 1 sends a TPDU that arrives properly at host 2. Then host 1 sends another TPDU. Unfortunately, host 2 issues a DISCONNECT before the second TPDU arrives. The result is that the connection is released and data are lost. Symmetric ReleaseEach direction is released independently of the other on

49、e. a host can continue to receive data even after it has sent a DISCONNECT TPDU.One can envision a protocol : host 1 says: I am done. Are you done too? host 2 responds: I am done too. Goodbye. the connection can be safely released. Two-army problem The two-army problem.Two-army problemScenario:a whi

50、te army is encamped in a valley.On both of the surrounding hillsides are blue armies. The white army is larger than either of the blue armies alone, but together the blue armies are larger than the white army. If either blue army attacks by itself, it will be defeated, but if the two blue armies att

51、ack simultaneously, they will be victorious. What is the Question?The blue armies want to synchronize their attacks. However, their only communication medium is to send messengers on foot down into the valley, where they might be captured and the message lost (i.e., they have to use an unreliable co

52、mmunication channel). The question is: Does a protocol exist that allows the blue armies to win? Battle or not?SupposeSuppose that the commander of blue army #1 sends a message reading: I propose we attack at dawn on March 29. How about it? Now suppose that the message arrives, the commander of blue

53、 army #2 agrees, and his reply gets safely back to blue army #1. Will the attack happen? Probably not, because commander #2 does not know if his reply got through. If it did not, blue army #1 will not attack, so it would be foolish for him to charge into battle. Three-way handshake or Four-way hands

54、hake?Making a Three-way handshake:The initiator of the original proposal must acknowledge the response. Assuming no messages are lost, blue army #2 will get the acknowledgement, but the commander of blue army #1 will now hesitate. After all, he does not know if his acknowledgement got through, and i

55、f it did not, he knows that blue army #2 will not attack. We could now make a four-way handshake protocol, but that does not help either. Two-army problemTwo-army problem: synchronizing through unreliable channelIn fact: no solutionAssume a protocol existed If the last message is not essential, remo

56、ve it until the last one is essentialIf the message is essential, since the channel is unreliable, it may be lostIt it is lost, since it is essential, no synchronization is possibleReleasing connectionsThe issue is: How does one side know that the other side has seen its disconnect message?If neithe

57、r side is prepared to disconnect until it is convinced that the other side is prepared to disconnect too, the disconnection will never happen. Prepare to take riskIn practice, one is usually prepared to take more risks when releasing connections than when attacking white armies, so the situation is

58、not entirely hopeless.To be ABSOLUTELY sure is impossible, the next Figure shows a number of methods that work in practice, though they become increasingly more iffy.those protocols is not infallible, it is usually adequate. Connection Release Four protocol scenarios for releasing a connection. Norm

59、al case of a three-way handshake. (b) final ACK lost.(DR, Disconnection Request)Connection Release (c) Response lost. (d) Response lost and subsequent DRs lost.Four protocol scenariosthe normal case: one of the users sends a DR TPDU to initiate the connection release. When it arrives, the recipient

60、sends back a DR TPDU, too, and starts a timer, just in case its DR is lost. When this DR arrives, the original sender sends back an ACK TPDU and releases the connection. Finally, when the ACK TPDU arrives, the receiver also releases the connection. If the final ACK TPDU is lost, the situation is sav

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论