川大林锋计网第三次作业任务.docx
《川大林锋计网第三次作业任务.docx》由会员分享,可在线阅读,更多相关《川大林锋计网第三次作业任务.docx(7页珍藏版)》请在冰豆网上搜索。
川大林锋计网第三次作业任务
ReviewQuestions:
3.ConsideraTCPconnectionbetweenHostAandHostB.SupposethattheTCPsegmentstravelingfromHostAtoHostBhavesourceportnumberxanddestinationportnumbery.WhatarethesourceanddestinationportnumbersforthesegmentstravelingfromHostBtoHostA?
Thesourceportnumberisy,thedestinationportnumberisx.
5.WhyisitthatvoiceandvideotrafficisoftensentoverTCPratherthanUDPintoday’sInternet.(Hint:
TheanswerwearelookingforhasnothingtodowithTCP’scongestion-controlmechanism.)
因为UDP虽然传输速度快,不需要建立对等连接,但是容易丢包,而且数据包顺序容易混乱;TCP传输更稳定,文件没有丢失或者损失。
6.IsitpossibleforanapplicationtoenjoyreliabledatatransferevenwhentheapplicationrunsoverUDP?
Ifso,how?
是的,只需要在UDP的协议上添加验证的数据,比如给每个包传输时加个头,并且设置返回值,还有很多其他方法在此不一一列举了。
7.SupposeaprocessinHostChasaUDPsocketwithportnumber6789.SupposebothHostAandHostBeachsendsaUDPsegmenttoHostCwithdestinationportnumber6789.WillbothofthesesegmentsbedirectedtothesamesocketatHostC?
Ifso,howwilltheprocessatHostCknowthatthesetwosegmentsoriginatedfromtwodifferenthosts?
正解,两个部分将针对同一接口。
在套接字接口,对于每个收到的片段,操作系统将提供过程与IP地址确定各段的起源。
8.SupposethataWebserverrunsinHostConport80.SupposethisWebserverusespersistentconnections,andiscurrentlyreceivingrequestsfromtwodifferentHosts,AandB.ArealloftherequestsbeingsentthroughthesamesocketatHostC?
Iftheyarebeingpassedthroughdifferentsockets,dobothofthesocketshaveport80?
Discussandexplain.
对于每个坚持的连接,web服务器会创建一个连接套接字,每个连接套接字由4个数组定义。
当主机C收到一个请求的时候,它会检查数据报和段中的4个区域,以此决定用哪个区域来接收TCP段。
因此,A和B传输的套接字是不一样的。
每一个套接字的标识符都使用80端口作为目的的,但是不同的资源有不同的IP地址。
和UDP不同,当传输层传输一个TCP段至应用层的时候,它并不需要明确指定IP地址,因为套接字标识符会帮它指定。
14.Trueorfalse?
(F)a.HostAissendingHostBalargefileoveraTCPconnection.AssumeHostBhasnodatatosendHostA.HostBwillnotsendacknowledgmentstoHostAbecauseHostBcannotpiggybacktheacknowledgmentsondata.
(F)b.ThesizeoftheTCPrwndneverchangesthroughouttheduration(持续时间)oftheconnection.
(T)c.SupposeHostAissendingHostBalargefileoveraTCPconnection.ThenumberofunacknowledgedbytesthatAsendscannotexceedthesizeofthereceivebuffer.
(F)d.SupposeHostAissendingalargefiletoHostBoveraTCPconnection.Ifthesequencenumberforasegmentofthisconnectionism,thenthesequencenumberforthesubsequentsegmentwillnecessarilybem+1.
(T)e.TheTCPsegmenthasafieldinitsheaderforrwnd.
(F)f.SupposethatthelastSampleRTTinaTCPconnectionisequalto1sec.ThecurrentvalueofTimeoutIntervalfortheconnectionwillnecessarilybe≥1sec.ComputerNetworkingfile:
///C|/Users/liwin/Desktop/新建文件夹/dummy_split_025.html[2012/4/1512:
46:
20]
()g.SupposeHostAsendsonesegmentwithsequencenumber38and4bytesofdataoveraTCPconnectiontoHostB.Inthissamesegmenttheacknowledgmentnumberisnecessarily42.
15.SupposeHostAsendstwoTCPsegmentsbacktobacktoHostBoveraTCPconnection.Thefirstsegmenthassequencenumber90;thesecondhassequencenumber110.
a.Howmuchdataisinthefirstsegment?
110-90=20
b.SupposethatthefirstsegmentislostbutthesecondsegmentarrivesatB.IntheacknowledgmentthatHostBsendstoHostA,whatwillbetheacknowledgmentnumber?
90
17.SupposetwoTCPconnectionsarepresentoversomebottlenecklinkofrateRbps.Bothconnectionshaveahugefiletosend(inthesamedirectionoverthebottlenecklink).Thetransmissionsofthefilesstartatthesametime.WhattransmissionratewouldTCPliketogivetoeachoftheconnections?
R/2
Problems:
1.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.
2.ConsiderFigure3.5.Whatarethesourcesanddestinationportvaluesinthesegmentsflowingfromtheserverbacktotheclients’processes?
在段中,资源和目的端口从服务器返回用户进程的价值是什么?
WhataretheIPaddressesinthenetwork-layerdatagramscarryingthetransport-layersegments?
网络层数据报中携带的传输层段里的IP地址是什么?
<1>返回值包含了客户端和服务器的IP地址以及port码,还有用户索求的内容。
<2>网络层数据报中携带的IP地址包含目的端口的IP地址、port码、传输层添加的头(message)、网络层添加的段(segment)。
5.a.Supposeyouhavethefollowing2bytes:
01011100and01010110.Whatisthe1scomplementofthesumofthese2bytes?
01011100+01010110=10110010
取反=0110010
b.Supposeyouhavethefollowing2bytes:
11011010and00110110.Whatisthe1scomplementofthesumofthese2bytes?
11011010+00110110=100010000
去首位补至末位=00010001
取反=11101110
c.Forthebytesinpart(a),giveanexamplewhereonebitisflippedineachofthe2bytesandyetthe1scomplementdoesn’tchange.
18.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
19.Answertrueorfalsetothefollowingquestionsandbrieflyjustifyyouranswer:
(T)a.WiththeSR(selectiverepeat)protocol,itispossibleforthesendertoreceiveanACKforapacketthatfallsoutsideofitscurrentwindow.
(T)b.WithGBN,itispossibleforthesendertoreceiveanACKforapacketthatfallsoutsideofitscurrentwindow.
(T)c.Thealternating-bitprotocolisthesameastheSRprotocolwithasenderandreceiverwindowsizeof1.
(T)d.Thealternating-bitprotocol(rdt3.0)isthesameastheGBNprotocolwithasenderandreceiverwindowsizeComputerNetworkingfile:
///C|/Users/liwin/Desktop/新建文件夹/dummy_split_025.html[2012/4/1512:
46:
20]of1.
21.ConsidertheGBNandSRprotocols.Supposethesequencenumberspaceisofsizek.WhatisthelargestallowablesenderwindowthatwillavoidtheoccurrenceofproblemssuchasthatinFigure3.27foreachoftheseprotocols?
首先我们必须保证发送窗口和接受窗口中序列号都不重复。
假设窗口的序列号为a,那么序列号k必须保持k≥2a,才能使窗口中的序列号不重复。
22.WehavesaidthatanapplicationmaychooseUDPforatransportprotocolbecauseUDPoffersfinerapplicationcontrol(thanTCP)ofwhatdataissentinasegmentandwhen.
a.Whydoesanapplicationhavemorecontrolofwhatdataissentinasegment?
看了答案,不理解为什么答案只说明TCP和UDP传输的特点。
我的理解是应该说明传输层对TCP和UDP的控制和转换问题,但是我不会,坐等老师上课解,另附标准答案,希望助教大大不要怪我照抄。
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.
23.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。
24.HostAandBarecommunicatingoveraTCPconnection,andHostBhasalreadyreceivedfromAallbytesupthroughbyte126.SupposeHostAthensendstwosegmentstoHostBback-to-back.Thefirstandsecondsegmentscontain70and50bytesofdata,respectively.Inthefirstsegment,thesequencenumberis127,thesourceportnumberis302,andthedestinationportnumberis80.HostBsendsanacknowledgementwheneveritreceivesasegmentfromHostA.
a.InthesecondsegmentsentfromHostAtoB,whatarethesequencenumber,sourceportnumber,anddestinationportnumber?
Thesequencenumberis247,thesourcenumberis302,thedestinationnumberis80.
b.Ifthefirstsegmentarrivesbeforethesecon