計(jì)算機(jī)網(wǎng)絡(luò)自頂向下Chapter3_第1頁
計(jì)算機(jī)網(wǎng)絡(luò)自頂向下Chapter3_第2頁
計(jì)算機(jī)網(wǎng)絡(luò)自頂向下Chapter3_第3頁
計(jì)算機(jī)網(wǎng)絡(luò)自頂向下Chapter3_第4頁
計(jì)算機(jī)網(wǎng)絡(luò)自頂向下Chapter3_第5頁
已閱讀5頁,還剩105頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

第3章運(yùn)輸層

運(yùn)輸層要解決什么問題?

?IP層協(xié)議主機(jī)之間傳遞數(shù)據(jù)報(bào)

?IP地址只標(biāo)識(shí)主機(jī),并不區(qū)分應(yīng)用程序或哪個(gè)用戶,

-?區(qū)分應(yīng)用程序或用戶——

端到端的運(yùn)輸層協(xié)議來完成的

2<A金

Chapter3outline

3.1Transport-layerservices

3.2Connectionlesstransport:UDP

3.3Principlesofreliabledatatransfer

3.4Corniection-orientedtransport:TCP

3.4.1segmentstructure

3.4.2connectionmanagement

3.4.3reliabledatatransfer

3.4.4flowcontrol

3.4.5congestioncontrol

3<A金

3.1Transport-layerservices

?providelogicalcommunicationbetweenapp

processesrunningondifferenthosts

4transportprotocolsruninendsystems

>sendside:breaksappmessagesintosegments,

passestonetworklayer

>revside:reassemblessegmentsintomessages,

passestoapplayer

?morethanonetransportprotocolavailabletoapps

>Internet:TCPandUDP

logicalcommunication

hostAhostB

router1router2

APAP

AP

------------IP協(xié)議的作用范圍--------

運(yùn)輸層協(xié)議TCP和UDP的作用范圍a

3.1Transport-layerservices

Transportvs.networklayer

?networklayer:logicalcommunicationbetweenhosts

?transportlayer:logicalcommunicationbetweenprocesses

>reliesonfenhances,networklayerservices

Householdanalogy:

12kidssendinglettersto12kids

?processes=kids

?appmessages=lettersinenvelopes

?hosts=houses

?transportprotocol=AnnandBill

?network-layerprotocol=postalservice

3.1Transport-layerservices6<A金

Internettransport-layerprotocols

?reliable,in-orderdelivery:TCP

>congestioncontrol

>flowcontrol

>connectionsetup

?unreliable,unordereddelivery:UDP

>no-frillsextensionof%'best-effort/,IP

?servicesnotavailable:

>delayguarantees

>bandwidthguarantees

?Multiplexing/demultiplexing

3.1Transport-layerservices7<A金

Multiplexing/demultiplexing

Multiplexingatsendhost:Demultiplexingatrevhost:

gatheringdatafrommultiplesockets,deliveringreceivedsegments

envelopingdatawithheadertocorrectsocket

(laterusedfordemultiplexing)

3.1Transport-layerservices8

Howdemultiplexingworks

?hostreceivesIPdatagrams

>eachdatagramhassource

IPaddress,destinationIP<-------------32bits--------------->

addresssourceport#destport#

>eachdatagramcarries1

transport-layersegmentotherheaderfields

>eachsegmenthassource,

destinationportnumber

(recall:well-knownportapplication

data

numbersforspecific(message)

applications)

?hostusesIPaddresses&port

numberstodirectsegmenttoTCP/UbPsegmentformat

appropriatesocket

3.1Transport-layerservices9

port

?為每個(gè)需要通信的應(yīng)用程序分配一個(gè)通訊端口(Port),在

TCP/IP中,其值為1?216,用于唯一標(biāo)識(shí)一個(gè)進(jìn)程;

?端口的分配有:

?熟知端口,數(shù)值一般為。?1023。

>登記端口號(hào),數(shù)值為1024?49151,為沒有熟知端口號(hào)的應(yīng)用程序

使用的。使用這個(gè)范圍的端口號(hào)必須在IANA登記,以防止重復(fù)。

>客戶端口號(hào)或短暫端口號(hào),數(shù)值為49152?65535,留給客戶進(jìn)程選

擇暫時(shí)使用。當(dāng)服務(wù)器進(jìn)程收到客戶進(jìn)程的報(bào)文時(shí),就知道了客戶進(jìn)

程所使用的動(dòng)態(tài)端口號(hào)。通信結(jié)束后,這個(gè)端口號(hào)可供其他客戶進(jìn)程

以后使用。

3.1Transport-layerservices1。

Chapter3outline

3.1Transport-layerservices

3.2Connectionlesstransport:UDP

3.3Principlesofreliabledatatransfer

3.4Connection-orientedtransport:TCP

>segmentstructure

>connectionmanagement

>reliabledatatransfer

>flowcontrol

>congestioncontrol

UDP:UserDatagramProtocol[RFC768]

?"nofrills,”“barebones55Internettransportprotocol

?“besteffort99service,UDPsegmentsmaybe:

>lost

>deliveredoutofordertoapp

?connectionless:

>nohandshakingbetweenUDPsender,receiver

>eachUDPsegmenthandledindependentlyofothers

WhyisthereaUDP?

?noconnectionestablishment(whichcanadddelay)

?simple:noconnectionstateatsender,receiver

?smallsegmentheader(8:20)

?nocongestioncontrol:UDPcanblastawayasfastasdesired

3,2Connectionlesstransport:UDP12

面向報(bào)文的UDP

?發(fā)送方UDP對(duì)應(yīng)用程序交下來的報(bào)文,在添加首部后就向下交付IP層。

UDP對(duì)應(yīng)用層交下來的報(bào)文,既不合并,也不拆分,而是保留這些報(bào)文的

邊界。

?應(yīng)用層交給UDP多長的報(bào)文,UDP就照樣發(fā)送,即一次發(fā)送一個(gè)報(bào)文。

?接收方UDP對(duì)IP層交上來的UDP用戶數(shù)據(jù)報(bào),在去除首部后就原封不動(dòng)

地交付上層的應(yīng)用進(jìn)程,一次交付一個(gè)完整的報(bào)文。

?應(yīng)用程序必須選擇合適大小的報(bào)文。

applicationlayermessageapplicationlayer

UDPheaderUDPseqementdataTransportlayer

IPheaderIPpacketdataNetworklayer

13

UDP:more

?oftenusedforstreaming32bits

multimediaapps

sourceport#destport#

>losstolerantLength,in

bytesofUbP^^lengthchecksum

>ratesensitivesegment,

?otherUDPusesincluding

>DNSheader

>SNMPApplication

?reliabletransferoverUDP:data

addreliabilityatapplication(message)

layer

>application-specificUbPsegmentformat

errorrecovery!

(rememberitzlatercomparewithTCP)

3,2Connectionlesstransport:UDP14

UDPsegment

UDPSourcePort(16)UDPDestinationPort(16)

MessageLength(16)UDPChecksum(16)

DATA

UDP偽首部

SourceIPAddress(32)

DestinationIPAddress(32)

Zero(8)Protocol(8)UDPLength(16)

?Protocol—協(xié)議類型,UDP:17;

?UDPLength—首部+數(shù)據(jù)區(qū)的總長度,不包括偽首部。

?注意:偽首部并不包括在UDP報(bào)文中,使用偽首部是為了驗(yàn)證UDP是否到達(dá)

正確的目的端:當(dāng)目的端收到UDP包后,計(jì)算出校驗(yàn)和,當(dāng)與UDP包中校驗(yàn)

和相同時(shí),則說明該UDP包到達(dá)了正確的主機(jī)和正確的端口。

3.2Connectionlesstransport:UDPis

Example:UDPchecksum(檢驗(yàn)和)

1001100100010011一153.19

040000100001101000一8.104

12字節(jié)

偽首部,11010101100000011->171.3

全017150000111000001011一14.11

8字節(jié)10:57130000000000010001一0和17

UDP首部”15全00000000000001111一15

0000010000111111一1087

7字節(jié)datadatadatadata

0000000000001101一13

數(shù)據(jù)datadatadata全0

0000000000001111一15

填條0000000000000000一0(檢驗(yàn)和)

0101010001000101—>data

0101001101010100—>data

0100100101001110—>data

0100011100000000—>data,0(填充)

按二進(jìn)制反碼運(yùn)算求和1001011011101101一求和得出的結(jié)果

將得出的結(jié)果求反碼0110100100010010一檢驗(yàn)和

Chapter3outline

3.1Transport-layerservices

3.2Connectionlesstransport:UDP

3.3Principlesofreliabledatatransfer

3.4Connection-orientedtransport:TCP

>segmentstructure

>connectionmanagement

>reliabledatatransfer

>flowcontrol

>congestioncontrol

17

3.3Principlesofreliabledatatransfer

3.3.1stop-and-waitprotocol

AB

?在發(fā)送完一個(gè)分組后,必須暫時(shí)保留

已發(fā)送的分組的副本。

?分組和確認(rèn)分組都必須進(jìn)行編號(hào)。

⑻無差錯(cuò)情況?超時(shí)計(jì)時(shí)器的重傳時(shí)間應(yīng)當(dāng)比數(shù)據(jù)在

分組傳輸?shù)钠骄禃r(shí)間更長一些。

確認(rèn)丟失和確認(rèn)遲到

(a)確認(rèn)丟失(b)確認(rèn)遲到

3.3Principlesofreliabledatatransfer19

可靠通信的實(shí)現(xiàn)

?使用上述的確認(rèn)和重傳機(jī)制,我們就可以在不

可靠的傳輸網(wǎng)絡(luò)上實(shí)現(xiàn)可靠的通信。

?這種可靠傳輸協(xié)議常稱為自動(dòng)重傳請(qǐng)求ARQ

(AutomaticRepeatreQuest)。

?ARQ表明重傳的請(qǐng)求是自動(dòng)進(jìn)行的。接收方

不需要請(qǐng)求發(fā)送方重傳某個(gè)出錯(cuò)的分組。

3.3Principlesofreliabledatatransfer20

信道利用率

?停止等待協(xié)議的優(yōu)點(diǎn)是簡單,但缺點(diǎn)是信道利用

率太低。

3.3Principlesofreliabledatatransfer21

流水線(Pipeline)傳輸

?發(fā)送方可連續(xù)發(fā)送多個(gè)分組,不必每發(fā)完一個(gè)分組就停

頓下來等待對(duì)方的確認(rèn)。

?由于信道上一直有數(shù)據(jù)不間斷地傳送,這種傳輸方式可

獲得很高的信道利用率。

3.3Principlesofreliabledatatransfer22

3.3.2連續(xù)ARQ協(xié)議

發(fā)送窗口

1|2|3|4|5%7|8|9|10|H|12

(a)發(fā)送令維持發(fā)送窗口(發(fā)送窗口是5)

發(fā)送窗口「口

??向刖

12|3|4|5|67|8|9|10|H|12

(b)收到二了確及后發(fā)送窗口向前滑動(dòng)

噬獻(xiàn)

個(gè)

發(fā)送

確認(rèn)

按序

送確

認(rèn)

強(qiáng)

到達(dá)

發(fā)

最后

典±■

分<

為r

個(gè)

點(diǎn)

使

現(xiàn)

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論