四川大学林峰计算机网络第三次作业.docx

上传人:b****5 文档编号:4496913 上传时间:2022-12-01 格式:DOCX 页数:7 大小:20.31KB
下载 相关 举报
四川大学林峰计算机网络第三次作业.docx_第1页
第1页 / 共7页
四川大学林峰计算机网络第三次作业.docx_第2页
第2页 / 共7页
四川大学林峰计算机网络第三次作业.docx_第3页
第3页 / 共7页
四川大学林峰计算机网络第三次作业.docx_第4页
第4页 / 共7页
四川大学林峰计算机网络第三次作业.docx_第5页
第5页 / 共7页
点击查看更多>>
下载资源
资源描述

四川大学林峰计算机网络第三次作业.docx

《四川大学林峰计算机网络第三次作业.docx》由会员分享,可在线阅读,更多相关《四川大学林峰计算机网络第三次作业.docx(7页珍藏版)》请在冰豆网上搜索。

四川大学林峰计算机网络第三次作业.docx

四川大学林峰计算机网络第三次作业

Chapter3ReviewQuestions

R3.DescribewhyanapplicationdevelopermightchoosetorunanapplicationoverUDPratherthanTCP?

答:

Anapplicationdevelopermaynotwantitsapplicationtouse

TCP’scongestioncontrol,whichcanthrottletheapplication'ssendingrateattimesofcongestion。

Often,designersofIPtelephonyandIPvideoconferenceapplicationschoosetoruntheirapplicationsoverUDPbecausetheywanttoavoidTCP’scongestioncontrol。

Also,someapplicationsdonotneedthereliabledatatransferprovidedbyTCP.

R5.IsitpossibleforanapplicationtoenjoyreliabledatatransferevenwhentheapplicationrunsoverUDP?

Ifso,how?

答:

是的,在UDP的协议上添加验证的数据,例如给每个包传输时加个头,并且设置返回值。

 

R6。

ConsideraTCPconnectionbetweenHostAandHostB.SupposethattheTCPsegmentstravelingfromHostAtoHostBhavesourceportnumberxanddestinationportnumbery.WhatarethesourceanddestinationportnumbersforthesegmentstravelingfromHostBtoHostA?

答:

Thesourceportnumberisy,thedestinationportnumberisx。

 

R7.SupposeaprocessinHostChasaUDPsocketwithportnumber6789。

SupposebothHostAandHostBeachsendsaUDPsegmenttoHostCwithdestinationportnumber6789.WillbothofthesesegmentsbedirectedtothesamesocketatHostC?

Ifso,howwilltheprocessatHostCknowthatthesetwosegmentsoriginatedfromtwodifferenthosts?

答:

正确,两个部分将针对同一接口.在套接字接口,对于每个收到的片段,操作系统将提供过程与IP地址确定各段的起源。

 

R8.SupposethataWebserverrunsinHostConport80。

SupposethisWebserverusespersistentconnections,andiscurrentlyreceivingrequestsfromtwodifferentHosts,AandB。

ArealloftherequestsbeingsentthroughthesamesocketatHostC?

Iftheyarebeingpassedthroughdifferentsockets,dobothofthesocketshaveport80?

Discussandexplain。

答:

对于每个坚持的连接,web服务器会创建一个连接套接字,每个连接套接字由4个数组定义。

当主机C收到一个请求的时候,它会检查数据报和段中的4个区域,以此决定用哪个区域来接收TCP段.因此,A和B传输的套接字是不一样的.每一个套接字的标识符都使用80端口作为目的的,但是不同的资源有不同的IP地址。

和UDP不同的是,当传输层传输一个TCP段至应用层的时候,它并不需要明确指定IP地址,因为套接字标识符会协助它指定。

 

R14。

SupposeHostAsendstwoTCPsegmentsbacktobacktoHostBoveraTCPconnection.Thefirstsegmenthassequencenumber90;thesecondhassequencenumber110。

a.Howmuchdataisinthefirstsegment?

答:

110-90=20

b.SupposethatthefirstsegmentislostbutthesecondsegmentarrivesatB。

IntheacknowledgmentthatHostBsendstoHostA,whatwillbetheacknowledgmentnumber?

答:

90

 

R15。

Trueorfalse?

 

(F)a。

ThesizeoftheTCPRcvWindowneverchangesthroughoutthedurationoftheconnection.

(T)b.SupposeHostAissendingHostBalargefileoveraTCPconnection.ThenumberofunacknowledgedbytesthatAsendscannotexceedthesizeofthereceivebuffer.

(F)c.HostAissendingHostBalargefileoveraTCPconnection。

AssumeHostBhasnodatatosendHostA。

HostBwillnotsendacknowledgmentstoHostAbecauseHostBcannotpiggybacktheacknowledgmentsondata.

(T)d。

TheTCPsegmenthasafieldinitsheaderforRcvWindow.

(F)e.SupposeHostAissendingalargefiletoHostBoveraTCPconnection.Ifthesequencenumberforasegmentofthisconnectionism,thenthesequencenumberforthesubsequentsegmentwillnecessarilybem+1。

(F)f.SupposethatthelastSampleRTTinaTCPconnectionisequalto1sec。

ThecurrentvalueofTimeoutIntervalfortheconnectionwillnecessarilybe≥1sec.

(T)g.SupposeHostAsendsonesegmentwithsequencenumber38and4bytesofdataoveraTCPconnectiontoHostB。

Inthissamesegmenttheacknowledgmentnumberisnecessarily42.

R17.Trueorfalse?

ConsidercongestioncontrolinTCP.Whenthetimerexpiresatthesender,thethresholdissettoonehalfofitspreviousvalue.

 

Problems

P1.SupposeClientAinitiatesaTelnetsessionwithServerS.Ataboutthesametime,ClientBalsoinitiatesaTelnetsessionwithServerS。

Providepossiblesourceanddestinationportnumbersfor

a.ThesegmentssentfromAtoS。

Thesourceportnumberis467,destinationnumberis23.

b。

ThesegmentssentfromBtoS。

Thesourceportis513,thedestinationnumberis23。

c.ThesegmentssentfromStoA.

Thesourceportis23,thedestinationnumberis467.

d.ThesegmentssentfromStoB。

Thesourceportis23,thedestinationnumberis513。

e。

IfAandBaredifferenthosts,isitpossiblethatthesourceportnumberinthesegmentsfromAtoSisthesameasthatfromBtoS?

Yes。

f。

Howaboutiftheyarethesamehost?

No。

 

P2.ConsiderFigure3.5。

Whatarethesourcesanddestinationportvaluesinthesegmentsflowingfromtheserverbacktotheclients'processes?

WhataretheIPaddressesinthenetwork—layerdatagramscarryingthetransport-layersegments?

答:

(1)返回值包含了客户端和服务器的IP地址以及port码,还有用户索求的内容.

(2)网络层数据报中携带的IP地址包含目的端口的IP地址、port码、传输层添加的头(message)、网络层添加的段(segment)。

P5.

a。

Supposeyouhavethefollowing2bytes:

01011100and01010110。

Whatisthe1scomplementofthesumofthese2bytes?

01011100+01010110=10110010取反=0110010

b。

Supposeyouhavethefollowing2bytes:

11011010and00110110.Whatisthe1scomplementofthesumofthese2bytes?

11011010+00110110=100010000

去首位补至末位=00010001取反=11101110

c。

Forthebytesinpart(a),giveanexamplewhereonebitisflippedineachofthe2bytesandyetthe1scomplementdoesn’tchange.

 

P18.ConsidertheGBNprotocolwithasenderwindowsizeof3andasequencenumberrangeof1,024。

Supposethatattimet,thenextin—orderpacketthatthereceiverisexpectinghasasequencenumberofk.Assumethatthemediumdoesnotreordermessages.Answerthefollowingquestions:

a.Whatarethepossiblesetsofsequencenumbersinsidethesender’swindowattimet?

Justifyyouranswer。

答:

因为窗口大小为3,接收方期待的下一列序号为k,所以t时刻发送窗口中序列号应为k,k+1,k+2。

b.WhatareallpossiblevaluesoftheACKfieldinallpossiblemessagescurrentlypropagatingbacktothesenderattimet?

Justifyyouranswer.

答:

由于序列号为0—1024,所以在t时刻,所有可能的ACK序号应为0≤ACKnumber≤1024。

 

P19.Answertrueorfalsetothefollowingquestionsandbrieflyjustifyyouranswer:

(T)a.WiththeSRprotocol,itispossibleforthesendertoreceiveanACKforapacketthatfallsoutsideofitscurrentwindow.

(T)b。

WithGBN,itispossibleforthesendertoreceiveanACKforapacketthatfallsoutsideofitscurrentwindow。

(T)c。

Thealternating—bitprotocolisthesameastheSRprotocolwithasenderandreceiverwindowsizeof1。

(T)d。

Thealternating—bitprotocolisthesameastheGBNprotocolwithasenderandreceiverwindowsizeof1.

 

P21。

ConsidertheGBNandSRprotocols.Supposethesequencenumberspaceisofsizek.WhatisthelargestallowablesenderwindowthatwillavoidtheoccurrenceofproblemssuchasthatinFigure3.27foreachoftheseprotocols?

答:

首先我们必须保证发送窗口和接受窗口中序列号都不重复。

假设窗口的序列号为x,那么序列号n必须保持n〉=2x,才能使窗口中的序列号不重复.

 

P22.WehavesaidthatanapplicationmaychooseUDPforatransportprotocolbecauseUDPoffersfinerapplicationcontrol(thanTCP)ofwhatdataissentinasegmentandwhen。

a.Whydoesanapplicationhavemorecontrolofwhatdataissentinasegment?

答:

Considersending anapplication messageoveratransportprotocol。

WithTCP,the application writes data totheconnection‘ssendbufferandTCPwillgrabbyteswithoutnecessarilyputtingasinglemessageintheTCPsegment;TCPmayput more orlessthanasinglemessageinasegment.UDP,ontheotherhand,encapsulatesinasegmentwhateverthe application givesit;sothat,ifthe application givesUDP anapplication message,thismessagewillbethepayload of theUDPsegment.

Thus,withtheUDP,anapplication has more control of what data issentinasegment。

 

b.Whydoesanapplicationhavemorecontrolonwhenthesegmentissent?

答:

WithTCP,duetoflow control andcongestion control,theremaybesignificantdelayfromthetimewhen an application writes data toitssendbufferuntilwhenthe data isgiventothenetworklayer。

UDP does not have delaysduetoflowcontrol andcongestion control.

P23.ConsidertransferringanenormousfileofLbytesfromHostAtoHostB。

AssumeanMSS(managementsupportsystem)of1460bytes。

a。

WhatisthemaximumvalueofLsuchthatTCPsequencenumbersarenotexhausted?

RecallthattheTCPsequencenumberfieldhas4bytes.

答:

因为TCP序号范围有4bytes,所以L最大为2^32bytes

b。

FortheLyouobtainin(a),findhowlongittakestotransmitthefile.Assumethatatotalof66bytesoftransport,network,anddata-linkheaderareaddedtoeachsegmentbeforetheresultingpacketissentoutovera155Mbpslink.IgnoreflowcontrolandcongestioncontrolsoAcanpumpoutthesegmentsbacktobackandcontinuously。

答:

传输速度为155Mbps,每段加66bytes大小的头,首先计算一共分多少段:

2^32bytes/1460bytes=2941758段

每段加一个头,则头大小的和为:

2941758X66bytes=194156028bytes,总共需传输194156028bytes+2^32bytes=4489123324bytes=35912986592bits的数据。

用10Mbps的速度传输则时间为35912986592bits/Mbps=3591s=59。

85min。

 

P24。

HostAandBarecommunicatingoveraTCPconnection,andHostBhasalreadyreceivedfromAallbytesupthroughbyte126。

SupposeHostAthensendstwosegmentstoHostBback-to-back。

Thefirstandsecondsegmentscontain70and50bytesofdata,respectively。

Inthefirstsegment,thesequencenumberis127,thesourceportnumberis302,andthedestinationportnumberis80。

HostBsendsanacknowledgementwheneveritreceivesasegmentfromHostA。

a.InthesecondsegmentsentfromHostAtoB,whatarethesequencenumber,sourceportnumber,anddestinationportnumber?

答:

Thesequencenumberis247,thesourcenumberis302,thedestinationnumberis80.

b。

Ifthefirstsegmentarrivesbeforethesecondsegment,intheacknowledgementofthefirstarrivingsegment,whatistheacknowledgmentnumber,thesourceportnumber,andthedestinationportnumber?

答:

Theacknowledgenumberis197,thesourcenumberis80andth

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 高中教育

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1