四川大学林峰计算机网络第三次作业Word下载.docx
《四川大学林峰计算机网络第三次作业Word下载.docx》由会员分享,可在线阅读,更多相关《四川大学林峰计算机网络第三次作业Word下载.docx(7页珍藏版)》请在冰豆网上搜索。
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
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。
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
givesit;
sothat,ifthe
givesUDP
message,thismessagewillbethepayload
of
theUDPsegment.
Thus,withtheUDP,anapplication
has
control
what
issentinasegment。
b.Whydoesanapplicationhavemorecontrolonwhenthesegmentissent?
WithTCP,duetoflow
andcongestion
control,theremaybesignificantdelayfromthetimewhen
an
toitssendbufferuntilwhenthe
isgiventothenetworklayer。
UDP
does
not
have
delaysduetoflowcontrol
control.
P23.ConsidertransferringanenormousfileofLbytesfromHostAtoHostB。
AssumeanMSS(managementsupportsystem)of1460bytes。
WhatisthemaximumvalueofLsuchthatTCPsequencenumbersarenotexhausted?
RecallthattheTCPsequencenumberfieldhas4bytes.
因为TCP序号范围有4bytes,所以L最大为2^32bytes
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.
Ifthefirstsegmentarrivesbeforethesecondsegment,intheacknowledgementofthefirstarrivingsegment,whatistheacknowledgmentnumber,thesourceportnumber,andthedestinationportnumber?
Theacknowledgenumberis197,thesourcenumberis80andth