1BilingualCourseNetworkCommunications网络通信(ForMasterStudentsintheDepartmentofElectronicEngineering)Chapter17TransportProtocolsInstructor:Dr.TianshuangQiuSchooloftheElectronicandInformationEngineeringFallof20052Introduction•Thetransportprotocolprovidesanend-to-enddatatransferservicethatshieldsupperlayerprotocolsfromthedetailsoftheintervening(中介)networkornetworks.Atransportprotocolcanbeeitherconnectionoriented,suchasTCP(Transmissioncontrolprotocol),orconnectionless,suchasUDP(Userdatagramprotocol).•Iftheunderlying(下层)networkorinternetworkserviceisunreliable,suchaswiththeuseofIP,thenaconnection-orientedtransportprotocolbecomesquitecomplex.Thebasiccauseofthiscomplexityistheneedtodealwiththerelativelylargeandvariabledelaysexperiencedbetweenendsystems.Theselarge,variabledelayscomplicate(使复杂)theflowcontrolanderrorcontroltechniques.•TCPusesacredit-based(基于信用量)flowanderrorcontroltechniquethatissomewhatdifferentfromthesliding-windowflowcontrolfoundinX.25andHDLC.Inessence,TCPseparatesacknowledgementsfromthemanagementofthesizeoftheslidingwindow.•AlthoughtheTCPcredit-basedmechanismwasdesignedforend-to-endflowcontrol,itisalsousedtoassistininternetworkcongestioncontrol.WhenaTCPentitydetectsthepresenceofcongestionintheinternet,itreducestheflowofdataontotheinternetuntilitdetectsaneasing(缓解)incongestion.3传输层协议与其它协议的关系•Inaprotocolarchitecture,thetransportprotocolsitsaboveanetworkorinternetworklayer,whichprovidesnetworkrelatedservices,andjustbelowapplicationandotherupper-levelprotocols.Thetransportprotocolprovidesservicestotransportservice(TS)users,suchasFTP,SMTP,andTELNET.Thelocaltransportentitycommunicateswithsomeremotetransportentity,usingtheservicesofsomelowerlayer,suchastheinternetprotocol.Thegeneralserviceprovidedbyatransportprotocolistheend-to-endtransportofdatainawaythatshieldstheTSuserfromthedetailsoftheunderlyingcommunicationssystems.•Wefindthatmostofthecomplexityrelatestoconnection-orientedservices.Asmightbeexpected,thelessthenetworkserviceprovides,themorethetransportprotocols:transmissioncontrolprotocol(TCP)andUDP.4传输层协议与其它协议的关系5§17-1面向连接的传输协议机制•两种基本类型的服务–面向连接的•对应于虚电路方式。•面向连接的服务提供了TS用户之间(端到端)的一条逻辑连接的建立、维护以及终止操作。•是最常见的有效协议服务类型,有广泛的应用。•面向连接暗示了这种服务是可靠的。–面向非连接的•对应于数据报方式。61.可靠的顺序网络服务•假设–网络服务可以接受任意长度的报文;–以100%的可靠性按顺序交付到目的地。•这样的网络包括–具有X.25接口的高可靠分组交换网络;–使用LAPF(LinkAccessProcedureforFrameModeBearerServices)控制协议的帧中继网络;–使用面向连接的LLC服务的IEEE802.3局域网。•对于可靠的顺序网络服务,需要讨论–寻址(Addressing)–复用(Multiplexing)–流控制(Flowcontrol)–连接的建立/终止(Connectionestablishment/termination)7寻址•概念–某个给定的传输实体的用户希望与另一个传输实体的用户建立一条连接,或者进行无连接的数据传送。•需要为目标用户指定–用户的标识(Useridentification);–传输实体的标识(Transportentityidentification);–主机地址(Hostaddress);–网络编号(Networknumber)•返回8进一步说明•传输层协议必须能够从TS用户地址中推算出上面所列的所有信息。•典型情况下,用户地址定义为(主机,端口)。–通常,一个主机只有一个传输实体,这样就不需要传输实体的标识。•地址中应当包含传输协议类型标记(如TCP或UDP)。•在单一网络的情况下,“主机”标识的是连接到网络上的一个设备。•在互联网情况下,“主机”是一个全局互联网地址。•在TCP中,端口和主机的结合称为套接字(socket).•传输层不涉及路由选择,仅仅将地址的“主机”部分向下交付给网络服务。•“端口”包含在传输层首部中,由目的站的目的传输协议来使用。9复用•两种复用–传输协议复用•多个用户使用相同的传输协议;•通过端口号或服务访问点相互区分。–传输实体复用•上行复用(upwardmultiplexing),将单个低层的多个连接复用。(Multiplexingofmultipleconnectionsonasinglelower-levelconnection)•下行复用(downwardmultiplexing),将单个连接划分成多个低层连接–返回10流控制•传输层流量控制比较复杂,其原因–与实际传输时间相比,传输实体之间的传输时延比较长;–传输层是一个在网络和互联网之上操作的,因此传输时延可能是高度可变的,从而使得为丢失数据而重传时所使用的超时机制难以做到高效率。•四种流控方法(对于接收方)–什么也不做;–拒绝接受来自网络服务的后续报文段;–使用固定的滑动窗协议;–使用信用量机制(creditscheme)•返回11什么也不做•问题–溢出的报文将被丢弃;–发送端由于没有收到确认,会重新发送这些报文;–这样,发送方将不得不增加输出流量;•返回12反压(backpressure)机制•反压机制,即第二种选择–依赖于网络服务;–当缓存溢出时,拒绝接收来自网络的更多的服务,会触发网络内部的流控过程,从而抑制发送端的网络服务;–拒绝更多的报文段。•返回13第三种选择(滑动窗)•在数据单元上使用序号;•使用固定大小的窗口;•通过确认使窗口向前滑动•返回14第四种选择(信用量机制)•信用量机制–向接收方提供了更高级程度的数据流控制;–可以产生较平稳的数据流。•返回15信用量分配机制举例16信用量分配机制说明•Assumethat200octetsofdataaresentineachsegment.Initially,throughtheconnectionestablishmentprocess,thesendingandreceivingsequencenumbersaresynchronizedestablishmentprocess,thesendingandreceivingsequencenumbersaresynchronizedandAisgrantedaninitialcreditallocationof1400octets,beginningwithoctetnumber1001.Aftersending600octetsinthreesegments,Ahasshrunkitswindowtoasizeof800octets(numbers1601through2400).Followingreceiptofthesesegments,Backnowledgesreceiptofalloctetsthrough1601andissuesacreditof1000octets.ThismeansthatAcansendoctets1601through2600(5segments).However,bythetimethatB’smessagehasarrivedatA,Ahasalreadysenttwosegments,containingoctets1601through2000(whichwaspermissibleundertheinitialallocation).Thus,A’sremainingcreditatthispointisonly400octets(2segments).Astheexchangeproceeds,Aadvancesthetrailingedgeofitswindoweachtimethatittransmitsandadvancestheleadingedgeonlywhenitisgrantedcredit.17•SendingandReceivingPerspectives18§17-2TCP•概念–TCPisdesignedtoprovidereliablecommunicationbetweenpairsofprocesses(TCPusers)acrossavarietyofreliableandunreliablenetworksandinternets.TCPprovidestwousefulfacilitiesforlabelingdata:push(急迫)andurgent(紧急):•Datastreampush:ordinarily,TCPdecideswhensufficientdatahaveaccumulatedtoformasegmentfortransmission.TheTCPusercanrequireTCPtotransmitalloutstandingdatauptoandincludingthatlabeledwithapushflag.Onthereceivingend,TCPwilldeliverthesedatatotheuserinthes