版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Chapter3
TransportLayerComputerNetworking:ATopDownApproach
4thedition.
JimKurose,KeithRoss
Addison-Wesley,July2007.
Anoteontheuseofthesepptslides:We’remakingtheseslidesfreelyavailabletoall(faculty,students,readers).They’reinPowerPointformsoyoucanadd,modify,anddeleteslides(includingthisone)andslidecontenttosuityourneeds.Theyobviouslyrepresentalotofworkonourpart.Inreturnforuse,weonlyaskthefollowing:Ifyouusetheseslides(e.g.,inaclass)insubstantiallyunalteredform,thatyoumentiontheirsource(afterall,we’dlikepeopletouseourbook!)Ifyoupostanyslidesinsubstantiallyunalteredformonawwwsite,thatyounotethattheyareadaptedfrom(orperhapsidenticalto)ourslides,andnoteourcopyrightofthismaterial.Thanksandenjoy!JFK/KWRAllmaterialcopyright1996-2007J.FKuroseandK.W.Ross,AllRightsReserved1TransportLayerChapter3:TransportLayerOurgoals:
understandprinciplesbehindtransportlayerservices:multiplexing/demultiplexingreliabledatatransferflowcontrolcongestioncontrollearnabouttransportlayerprotocolsintheInternet:UDP:connectionlesstransportTCP:connection-orientedtransportTCPcongestioncontrol2TransportLayerVocabularyandTermTransport(传输/运输)Multiplex/De-multiplex(多路复用/多路分流)UDP(UserDatagramProtocol)
(用户数据报协议)TCP(TransmissionControlProtocol)
(传输控制协议)Reliability(Error/Loss)
Control(可靠性(差错/丢失)控制)QoS(QualityofService)(服务质量)Segments(报文段)datagram(数据报/报文段)Packet(包/分组)3TransportLayerChapter3outline3.1Transport-layerservices3.2Multiplexinganddemultiplexing3.3Connectionlesstransport:UDP3.4Principlesofreliabledatatransfer3.5Connection-orientedtransport:TCPsegmentstructurereliabledatatransferflowcontrolconnectionmanagement3.6Principlesofcongestioncontrol3.7TCPcongestioncontrol4TransportLayerTcessesrunningondifferenthoststransportprotocolsruninendsystems
sendside:breaksappl.messagesintosegments,passestonetworklayerreceiverside:re-assemblessegmentsintomessages,passestoapplicationlayermorethanonetransportprotocolavailabletoapplicationsInternet:TCPandUDPapplicationtransportnetworkdatalinkphysicalapplicationtransportnetworkdatalinkphysicallogicalend-endtransport5TransportLayerTworklayertransportlayer:
logicalcommunicationbetweenprocesses
relieson,enhances,networklayerservices
networklayer:
logicalcommunicationbetweenhosts6TransportLayerTworklayerHouseholdanalogy:12kidssendinglettersto12kidsprocesses=kidsapplicationmessages=lettersinenvelopeshosts=housestransportprotocol=AnnandBillnetwork-layerprotocol=postalservice7TransportLayerInternettransport-layerprotocolsreliable,in-orderdelivery:TCPcongestioncontrolflowcontrolconnectionsetupunreliable,unordereddelivery:UDPno-frillsextensionof“best-effort”IPservicesnotavailable:delayguaranteesbandwidthguaranteesapplicationtransportnetworkdatalinkphysicalnetworkdatalinkphysicalnetworkdatalinkphysicalnetworkdatalinkphysicalnetworkdatalinkphysicalnetworkdatalinkphysicalnetworkdatalinkphysicalapplicationtransportnetworkdatalinkphysicallogicalend-endtransport8TransportLayerChapter3outline3.1Transport-layerservices3.2Multiplexinganddemultiplexing3.3Connectionlesstransport:UDP3.4Principlesofreliabledatatransfer3.5Connection-orientedtransport:TCPsegmentstructurereliabledatatransferflowcontrolconnectionmanagement3.6Principlesofcongestioncontrol3.7TCPcongestioncontrol9TransportLayerMultiplexingAppl.1Port1UDPAppl.2Port2Appl.NPortNIPUDPdatagramtransmit10TransportLayerDe-multiplexingUDPIPUDPdatagramarrivesAppl.1Appl.2Appl.NPort1Port2PortN11TransportLayerMultiplexing/demultiplexingapplicationtransportnetworklinkphysicalP1applicationtransportnetworklinkphysicalapplicationtransportnetworklinkphysicalP2P3P4P1host1host2host3=process=socketdeliveringreceivedsegmentstocorrectsocketDemultiplexingatrcvhost:gatheringdatafrommultiplesockets,envelopingdatawithheader(fordemultiplexing)Multiplexingatsendhost:12TransportLayerHowde-multiplexingworkshostreceivesIPdatagramseachdatagramhassourceIPaddress,destinationIPaddresseachdatagramcarries1transport-layersegmenteachsegmenthassource,destinationportnumberhostusesIPaddresses&portnumberstodirectsegmenttoappropriatesocketsourceport#destport#32bitsapplicationdata(message)otherheaderfieldsUDPdatagram/segmentformat13TransportLayerConnectionlessdemultiplexingCreatesocketswithportnumbers:DatagramSocketmySocket1=newDatagramSocket(12534);DatagramSocketmySocket2=newDatagramSocket(12535);UDPsocketidentifiedbytwo-tuple:(IPaddress,portnumber)WhenhostreceivesUDPsegment:checksdestinationportnumberinsegmentdirectsUDPsegmenttosocketwiththatportnumberIPdatagramswithdifferentsourceIPaddressesand/orsourceportnumbersdirectedtosamesocket14TransportLayerConnectionlessdemuxltiplexingDatagramSocketserverSocket=newDatagramSocket(6428);ClientIP:BP2clientIP:AP1P1P3serverIP:CSP:6428DP:9157SP:9157DP:6428SP:6428DP:5775SP:5775DP:6428SPprovides“returnaddress”15TransportLayerConnection-orienteddemuxltiplexingTCPsocketidentifiedby4-tuple:sourceIPaddresssourceportnumberdestinationIPaddressdestinationportnumberreceivehostusesallfourvaluestodirectsegmenttoappropriatesocketSocketClientSocket=newSocket("hostname",6789)SocketconnectionSocket=welcomeSocket.accept()16TransportLayerConnection-orienteddemuxltiplexingServerhostmaysupportmanysimultaneousTCPsockets:eachsocketidentifiedbyitsown4-tupleWebservershavedifferentsocketsforeachconnectingclientnon-persistentHTTPwillhavedifferentsocketforeachrequest17TransportLayerConnection-orienteddemux(cont.)ClientIP:BP1clientIP:AP1P2P4serverIP:CSP:9157DP:80SP:9157DP:80P5P6P3D-IP:CS-IP:AD-IP:CS-IP:BSP:5775DP:80D-IP:CS-IP:B18TransportLayerConnection-orienteddemux:ThreadedWebServerClientIP:BP1clientIP:AP1P2serverIP:CSP:9157DP:80SP:9157DP:80P4P3D-IP:CS-IP:AD-IP:CS-IP:BSP:5775DP:80D-IP:CS-IP:B19TransportLayerChapter3outline3.1Transport-layerservices3.2Multiplexinganddemultiplexing3.3Connectionlesstransport:UDP3.4Principlesofreliabledatatransfer3.5Connection-orientedtransport:TCPsegmentstructurereliabledatatransferflowcontrolconnectionmanagement3.6Principlesofcongestioncontrol3.7TCPcongestioncontrol20TransportLayerWhyisthereaUDP?Simplenoconnectionstateatsender,receiverEfficientsmallsegmentheaderQuick(启动快)noconnectionestablishment(whichcanadddelay)nocongestioncontrol(传输快)UDPcanblastawayasfastasdesiredApplicationshaveBettercontroloverwhatandwhentosent21TransportLayerUDP:UserDatagramProtocol[RFC768]“nofrills,”“barebones”Internettransportprotocol“besteffort”service,UDPsegmentsmaybe:lostdeliveredoutofordertoappconnectionless:nohandshakingbetweenUDPsender,receivereachUDPsegmenthandledindependentlyofothersWhyisthereaUDP?noconnectionestablishment(whichcanadddelay)simple:noconnectionstateatsender,receiversmallsegmentheadernocongestioncontrol:UDPcanblastawayasfastasdesired22TransportLayerUDP:moreoftenusedforstreamingmultimediaappslosstolerantratesensitiveotherUDPusesDNSSNMPreliabletransferoverUDP:addreliabilityatapplicationlayerapplication-specificerrorrecovery!sourceport#destport#32bitsApplicationdata(message)UDPsegmentformatlengthchecksumLength,inbytesofUDPsegment,includingheader23TransportLayerMultiplexingMultiplexing(多路复用)MultipleapplicationsusingonetransportprotocolIdentifyapplicationusingportnumber(ApplicationAddressing)
UDP
TCP
111
161
69
25
21
23
RPC
SNMP
TFTP
SMTP
FTP
TELNET
IP
24TransportLayerPortnumberandProtocolnumberDeterminethehigherlayerprotocoltransportnetworkTCPUDPProtocol
NumbersIP17625TransportLayerPortswell-knownPorts(众所周知端口,公共端口)0~1023ReservedforstandardpublicserviceAlreadyallocated:1~1000RegisteredPorts(注册端口)1024~49151Registered:1025~48619Dynamic/PrivatePorts(私有端口)Notforpublicuse49152~6553526TransportLayerPortsAllocationAllocationAuthority/assignments/port-numbers(lastupdated26March2008)27TransportLayerUDPchecksumSender:treatsegmentcontentsassequenceof16-bitintegerschecksum:addition(1’scomplementsum)ofsegmentcontentssenderputschecksumvalueintoUDPchecksumfieldReceiver:computechecksumofreceivedsegmentcheckifcomputedchecksumequalschecksumfieldvalue:NO-errordetectedYES-noerrordetected.Butmaybeerrorsnonetheless?Morelater….Goal:detect“errors”(e.g.,flippedbits)intransmittedsegment28TransportLayerInternetChecksumExampleNoteWhenaddingnumbers,acarryoutfromthemostsignificantbitneedstobeaddedtotheresultExample:addtwo16-bitintegers1111001100110011011101010101010101110111011101110111101110111011110010100010001000011wraparoundsumchecksum29TransportLayerHomework&ExtensiveReadingReviews:4Problems:130TransportLayerChapter3Outline3.1Transport-layerservices3.2Multiplexinganddemultiplexing3.3Connectionlesstransport:UDP3.4Principlesofreliabledatatransfer3.5Connection-orientedtransport:TCPsegmentstructurereliabledatatransferflowcontrolconnectionmanagement3.6Principlesofcongestioncontrol3.7TCPcongestioncontrol31TransportLayerTCP:Overview
point-to-pointonesender,onereceiversend&receivebuffers
reliable,in-orderbytestreamno“messageboundaries”pipelinedTCPcongestionandflowcontrolsetwindowsizesocketdoorTCPsendbufferTCPreceivebuffersocketdoorsegmentapplicationwritesdataapplicationreadsdata32TransportLayerTCPfullduplex(全双工)databi-directionaldataflowinsameconnectionconnection-orientedhandshaking(exchangeofcontrolmsgs)initiatessender,receiverstatebeforedataexchangeflowcontrolledsenderwillnotoverwhelm(淹没)
receiversocketdoorTCPsendbufferTCPreceivebuffersocketdoorsegmentapplicationwritesdataapplicationreadsdata33TransportLayerRFC:793,1122,1323,2001,2018,2581
RF793TransmissionControlProtocolJ.Postel.September1981.RFC2001TCPSlowStart,CongestionAvoidance,FastRetransmit,andFast
RecoveryAlgorithms.
W.Stevens.January1997RFC2018TCPSelectiveAcknowledgmentOptionsM.Mathis,J.Mahdavi,S.Floyd,A.Romanow,October1996.RFC2581TCPCongestionControlM.Allman,V.Paxson,W.Stevens.April1999.34TransportLayerTCPScientistTCP/IPInventor1970:Cerf,V.,Carr,C.,Crocker,S.,Kahn,R.-NetworkControlProtocol,"Host-hostCommunicationProtocolintheARPANetwork“,AFIPSProceedingsofSJCC.IEEETrans.onCommunicationTechnology,197435TransportLayer36TransportLayerTCPScientistActiveQueueManagementTCP-FriendlycongestioncontrolHigh-PerformanceTCPSallyFloydLixiaZhangTCPTimers37TransportLayerChapter3outline3.1Transport-layerservices3.2Multiplexinganddemultiplexing3.3Connectionlesstransport:UDP3.4Principlesofreliabledatatransfer3.5Connection-orientedtransport:TCPsegmentstructurereliabledatatransferflowcontrolconnectionmanagement3.6Principlesofcongestioncontrol3.7TCPcongestioncontrol38TransportLayerVocabularyandTermReliability(Error/Loss)
Control可靠性(差错/丢失)控制FlowControl(流量控制)CongestionControl(拥塞控制)Acknowledge(ACK)确认Pipeline(流水线)RoundTripTime(RTT)往返时间Expire失效SlidingWindow
滑动窗口39TransportLayerTCPsegmentstructuresourceport#destport#32bitsapplicationdata(variablelength)sequencenumberacknowledgementnumberReceivewindowUrgdatapointerchecksumFSRPAUheadlennotusedOptions(variablelength)StartbyteinbytestreamsNextBytethereceiverexpectsForvariablelengthwithoptionsIt’sanACK.ACK#isValidSynchronize:initiateconnectionUrgentData:transmitimmediatelyPush(ImportantData):delivertoapp.quicklyDataFinished:teardowntheconnectionFatalError:Resettheconnection#bytesreceiver
iswilling
toaccept.UsedforflowcontrolInternet
checksum
(asinUDP)locationofthelastbyteof
urgentdataLikeMSS(MaximumSegmentSize)40TransportLayerTCPSequenceNo.’sandACKsSeq.#’s:bytestream“number”offirstbyteinsegment’sdataACKs:Seq#ofnextbyteexpectedfromothersideCumulative(累计)
ACKQ:howreceiverhandlesout-of-ordersegmentsA:TCPspecificationdoesn’tsay,-uptoimplementor(实现者)
HostAHostBSeq=42,ACK=79,data=‘C’Seq=79,ACK=43,data=‘C’Seq=43,ACK=80Usertypes‘C’hostACKsreceiptofechoed‘C’hostACKsreceiptof‘C’,echoesback‘C’timesimpletelnetscenario41TransportLayerWindowsize=1
Sender
ReceiverTCPSimple-ACKTCPSimple-ACKWindowsize=1
Sender
ReceiverSend1Receive1TCPSimple-ACKWindowsize=1
Sender
ReceiverSend1Receive1ReceiveACK2SendACK2TCPSimple-ACKWindowsize=1
Sender
ReceiverSend1Receive1ReceiveACK2SendACK2Send2Receive2TCPSimple-ACKWindowsize=1
Sender
ReceiverSend1Receive1ReceiveACK2SendACK2Send2Receive2ReceiveACK3SendACK3TCPSimple-ACKWindowsize=1
Sender
ReceiverSend1Receive1ReceiveACK2SendACK2Send2Receive2ReceiveACK3SendACK3Send3Receive3Windowsize=1
Sender
ReceiverSend1Receive1ReceiveACK2SendACK2Send2Receive2ReceiveACK3SendACK3Send3Receive3ReceiveACK4SendACK4TCPSimple-ACKPipelinedprotocolsPipelining:senderallowsmultiple,“in-flight”,yet-to-be-acknowledgedbytes/packetsrangeofsequencenumbersmustbeincreasedbufferingatsenderandreceiver49TransportLayerPipelining:increasedutilizationfirstpacketbittransmitted,t=0senderreceiverRTTlastbittransmitted,t=L/Rfirstpacketbitarriveslastpacketbitarrives,sendACKACKarrives,sendnextpacket,t=RTT+L/Rlastbitof2ndpacketarrives,sendACKlastbitof3rdpacketarrives,sendACKIncreaseutilizationbyafactorof3!50TransportLayerSourcePortDest.Port…Sequence#Acknowledgement#SourceDest.Seq.Ack.102823101TCP:seq.#’sandACKsData:40Bsent#10-#49.TCP:seq.#’sandACKsgot
#10-#49,nowIneed#50.SourcePortDest.Port…Sequence#Acknowledgement#102823SourceDest.10Seq.1Ack.102823SourceDest.50Seq.1Ack.sent#10-#49.Data:40BSourcePortDest.Port…Sequence#Acknowledgement#102823SourceDest.50Seq.2Ack.102823SourceDest.10Seq.1Ack.102823SourceDest.50Seq.1Ack.TCP:seq.#’sandACKsData:70BNowsent
#50-#119.SourcePortDest.Port…Sequence#Acknowledgement#102823SourceDest.50Seq.2Ack.102823SourceDest.10Seq.1Ack.102823SourceDest.50Seq.1Ack.102823SourceDest.120Seq.2Ack.TCP:seq.#’sandACKsData:70Bgot
#10-#119,nowIneed
#120.sent#50-#119.TCPRoundTripTimeandTimeoutQ:howtosetTCPtimeoutvalue?longerthanRTTbutRTTvariestooshort:prematuretimeoutunnecessaryretransmissionstoolong:slowreactiontosegmentloss55TransportLayerTCPRoundTripTimeandTimeoutQ:howtoestimateRTT?SampleRTT:measuredtimefromsegmenttransmissionuntilACKreceiptignoreretransmissionsSampleRTTwillvary,wantestimatedRTT“smoother”averageseveralrecentmeasurements,notjustcurrentSampleRTT56TransportLayerTCPRoundTripTimeandTimeoutEstimatedRTT=(1-)*EstimatedRTT+*SampleRTTExponentialWeightedMovingAverage(EWMA)(指数加权移动平均)influenceofpastsampledecreasesexponentiallyfasttypicalvalue:=0.12557TransportLayerExampleRTTestimation:58TransportLayerTCPRoundTripTimeandTimeoutSettingthetimeoutEstimtedRTTplus“safetymargin”largevariationinEstimatedRTT->largersafetymarginfirstestimateofhowmuchSampleRTTdeviatesfromEstimatedRTT:TimeoutInterval=EstimatedRTT+4*DevRTTDevRTT=(1-)*DevRTT+
*|SampleRTT-EstimatedRTT|(typically,=0.25)
Thensettimeoutinterval:59TransportLayerTCPRoundTripTimeandTimeoutTimeoutInterval=EstimatedRTT+4*DevRTTDevRTT=(1-)*DevRTT+*|SampleRTT-EstimatedRTT|
Thensettimeout(expiration)interval:EstimatedRTT=(1-)*EstimatedRTT+*SampleRTT60TransportLayerChapter3Outline3.1Transport-layerservices3.2Multiplexinganddemultiplexing3.3Connectionlesstransport:UDP3.4
Principlesofreliabledatatransfer3.5Connection-orientedtransport:TCPsegmentstructurereliabledatatransferflowcontrolconnectionmanagement3.6Principlesofcongestioncontrol3.7TCPcongestioncontrol61TransportLayer
TCP
Transmission
State62TransportLayerTCPreliabledatatransferTCPcreatesrdtserviceontopofIP’sunreliableservicePipelinedsegmentsCumulativeAcksTCPusessingleretransmissiontimerRetransmissionsaretriggeredby:timeouteventsduplicateAcksInitiallyconsidersimplifiedTCPsender:ignoreduplicateAcksignoreflowcontrol,congestioncontrol63TransportLayerTCPsenderevents:Datareceivedfromapplication:Createsegmentwithseq#seq#isbyte-streamnumberoffirstdatabyteinsegment(报文段)starttimerifnotalreadyrunning(thinkoftimerasforoldestunackedsegment)expirationinterval:TimeOutInterval(超时间隔)64TransportLayerTCPsenderevents:timeout:retransmitsegmentthatcausedtimeoutrestarttimerAckreceived:Ifacknowledgespreviouslyunackedsegmentsupdatewhatisknowntobeackedstarttimerifthereareoutstandingsegments65TransportLayerTCP
sender
(simplified)
NextSeqNum=InitialSeqNumSendBase=InitialSeqNum
loop(forever){
switch(event)
event:datareceivedfromapplicationabovecreateTCPsegmentwithsequencenumberNextSeqNumif(timercurrentlynotrunning)starttimerpasssegmenttoIPNextSeqNum=NextSeqNum+length(data)
event:timertimeoutretransmitnot-yet-acknowledgedsegmentwithsmallestsequencenumberstarttimer
event:ACKreceived,withACKfieldvalueofyif(y>SendBase){SendBase=yif(therearecurrentlynot-yet-acknowledgedsegments)starttimer}
}/*endofloopforever*/
Comment:SendBase-1:lastcumulatively
ack’edbyteExample:SendBase-1=71;
y=73,sothercvr
wants73+;
y>SendBase,so
thatnewdatais
acked66TransportLayerTCP:retransmissionscenariosHostASeq=92,8bytesdataACK=100losstimeoutlostACKscenarioHostBXSeq=92,8bytesdataACK=100timeSendBase=10067TransportLayerTCP:retransmissionscenariosHostASeq=100,20bytesdataACK=100timeprematuretimeout(过早超时)HostBSeq=92,8bytesdataACK=120Seq=92,8bytesdataSeq=92timeoutACK=120Seq=92timeoutSendBase=120SendBase=120Sendbase=10068TransportLayerTCPretransmissionscenarios(more)HostASeq=92,8bytesdataACK=100losstimeoutCumulativeACKscenarioHostBXSeq=100,20bytesdataACK=120timeSendBase=12069TransportLayerTCPAckgeneration
[RFC1122,RFC2581]EventatReceiverArrivalofin-ordersegmentwithexpectedseq#.Alldatauptoexpectedseq#alreadyACKedArrivalofin-ordersegmentwithexpectedseq#.OneothersegmenthasACKpendingArrivalofout-of-ordersegmenthigher-than-expectseq.#.GapdetectedArrivalofsegmentthatpartiallyorcompletelyfillsgapTCPReceiveractionDelayedACK.Waitupto500msfornextsegment.Ifnonextsegment,sendACKImmediatelysendsinglecumulativeACK,ACKingbothin-ordersegmentsImmediatelysendduplicateACK,indicatingseq.#ofnextexpectedbyteImmediatesendACK,providedthatsegmentstartsatlowerendofgap70TransportLayerFastRetransmitTime-outperiodoftenrelativelylong:longdelaybeforeresendinglostpacketDetectlostsegmentsviaduplicate(冗余)
Acks.Senderoftensendsmanysegmentsback-to-backIfsegmentislost,therewilllikelybemanyduplicateACKs.71TransportLayerFastRetransmitIfsenderreceives3Acksforthesamedata,itsupposesthatsegmentafterAckeddatawaslost:fastretransmit:
resendsegmentbeforetimerexpires72TransportLayerFastRetransmit73TransportLayer
event:ACKreceived,withACKfieldvalueofyif(y>SendBase){SendBase=yif(therearecurrentlynot-yet-acknowledgedsegments)starttimer}else{incrementcountofdupACKsreceivedforyif(countofdupACKsreceivedfory=3){resendsegmentwithsequencenumbery}
Fastretransmitalgorithm:aduplicateACKforalreadyACKedsegmentfastretransmit74TransportLayerGo-Back-NSender:k-bitseq#inpktheader“window”ofuptoN,consecutiveunack’edpktsallowedACK(n):ACKsallpktsupto,includingseq#n-“cumulativeACK”mayreceiveduplicateACKs(seereceiver)timerforeachin-flightpkttimeout(n):retransmitpktnandallhigherseq#pktsinwindow75TransportLayerGBNin
action76TransportLayerGo-Back-N:strength“window”ofuptoN,consecutiveunack’edpktsallowednextseqnum:smallestunusedsequencenumberACK(n):ACKsallpktsupto,
includingseq#n
-
“cumulativeACK”ReduceACKmessages,goodthroughput!77TransportLayerGo-Back-N:weakpointsnextseqnum:smallestunusedsequencenumberACK(n):ACKsallpktsupto,includingseq#n-“cumulativeACK”timerforeachin-flightpkttimeout(n):retransmitpktnandallhigherseq#pktsinwindowLOSTRe-transmit78TransportLayerSelectiveRepeatreceiverindividuallyacknowledgesallcorrectlyreceivedpktsbufferspkts,asneeded,foreventualin-orderdeliverytoupperlayersenderonlyresendspktsforwhichACKnotreceivedsendertimerforeachunACKedpktsenderwindowNconsecutiveseq#’sagainlimitsseq#sofsent,unACKedpkts79TransportLayerSelectiverepeat:sender,receiverwindows80TransportLayerSelectiverepeatdatafromabove:ifnextavailableseq#inwindow,sendpkttimeout(n):resendpktn,restarttimerACK(n)in[sendbase,sendbase+N]:markpktnasreceivedifnsmallestunACKedpkt,advancewindowbasetonextunACKedseq#senderpktnin[rcvbase,rcvbase+N-1]sendACK(n)out-of-order:bufferin-order:deliver(alsodeliverbuffered,in-orderpkts),advancewindowtonextnot-yet-receivedpktpktnin[rcvbase-N,rcvbase-1]ACK(n)otherwise:
ignorereceiver81TransportLayerSelectiverepeatinaction82TransportLayerHomework&ExtensiveReadingReviews:5,6Problems:2283TransportLayerChapter3Outline3.1Transport-layerservices3.2Multiplexinganddemultiplexing3.3Connectionlesstransport:UDP3.4Principlesofreliabledatatransfer3.5Connection-orientedtransport:TCPsegmentstructurereliabledatatransferflowcontrolconnectionmanagement3.6Principlesofcongestioncontrol3.7TCPcongestioncontrol84TransportLayerTCPFlowControlreceivesideofTCPconnectionhasareceivebuffer:applicationprocessmaybeslowatreadingfrombuffer85TransportLayerTCPFlowControlspeed-matchingservice:matchingthesendratetothereceivingapplication’sdrain(排干)
rate!senderwon’toverflowreceiver’sbufferbytransmittingtoomuch,toofastflowcontrol86TransportLayerTCPFlowcontrol:howitworks(SupposeTCPreceiverdiscardsout-of-ordersegments)spareroominbuffer=RcvWindow=RcvBuffer-[LastByteRcvd-LastByteRead]ReceiveradvertisesspareroombyincludingvalueofRcvWindowinsegmentsSenderlimitsunACKeddatatoRcvWindowguaranteesreceivebufferdoesn’toverflow87TransportLayerChapter3outline3.1Transport-layerservices3.2Multiplexinganddemultiplexing3.3Connectionlesstransport:UDP3.4Principlesofreliabledatatransfer3.5Connection-orientedtransport:TCPsegmentstructurereliabledatatransferflowcontrolconnectionmanagement3.6Principlesofcongestioncontrol3.7TCPcongestioncontrol88TransportLayerTCPConnectionManagementRecall:TCPsender,receiverestablish“connection”beforeexchangingdatasegmentsinitializeTCPvariables:seq.#s【ISN,InitialSequenceNumber】buffers,flowcontrolinfo(e.g.RcvWindow)client:connectioninitiator
SocketclientSocket=newSocket("hostname","portnumber");
connect(server,destPort)
server:contactedbyclient
SocketconnectionSocket=welcomeSocket.accept();89TransportLayerTCPConnectionManagementSYN,SEQ=xSYN,SEQ=y,ACK=x+1SYN,SEQ=x+1,ACK=y+1Threewayhandshake:Step1:
clienthostsendsTCPSYNsegmenttoserverspecifiesinitialseq#nodataStep2:
serverhostreceivesSYN,replieswithSYNACKsegmentserverallocatesbuffersspecifiesserverinitialseq.#Step3:clientreceivesSYNACK,replieswithACKsegment,whichmaycontaindata90TransportLayerTCPConnectionManagement(cont.)Closingaconnection:clientclosessocket:
clientSocket.close();
Step1:
clientendsystemsendsTCPFINcontrolsegmenttoserver
Step2:
serverreceivesFIN,replieswithACK.Closesconnection,sendsFIN.clientFINserverACKACKFINclosecloseclosedtimedwait91TransportLayerTCPConnectionManagement(cont.)S
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 积分商城积分购物合同模板
- 补充合同的条款解说
- 正规权威严谨委托检测服务合同
- 招标启示政府服装采购
- 香烟酒水紧急购销合同
- 解除房屋买卖合同重要通知
- 购销合同中英文版合同争议解决
- 印花税购销合同的合同纠纷执行和解
- 工艺品购销合同范本电子版
- 供应商合同中的供应商信用政策
- 地籍调查表(宅基地)模板
- 《树立正确的婚恋观》课件
- 安全培训:预防滑倒和摔伤
- 水利专业的职业生涯规划书
- 人教版2023-2024学年数学六年级上册 第四单元《比》单元真题拔高卷(参考答案)人教版
- 离心机安全应急预案
- 作业设计《质量守恒定律》
- GB/T 43320-2023焊缝无损检测超声检测薄壁钢构件自动相控阵技术的应用
- 网络安全漏洞培训与教育
- 机械气道廓清技术临床应用专家共识2023(完整版)
- 财产混同专项审计报告范文
评论
0/150
提交评论