概述
传送门:《计算机网络自顶向下方法第7版》英文×习题汇总
collected by:蛋卷超人
SECTION 3.1-3.3
R1. Suppose the network layer provides the following service. The network layer in the source
host accepts a segment of maximum size 1,200 bytes and a destination host address from the transport layer. The network layer then guarantees to deliver the segment to the transport layer at the destination host. Suppose many network application processes can be running at the destination host.
a. Design the simplest possible transport-layer protocol that will get application data to the desired process at the destination host. Assume the operating system in the destination host has assigned a 4-byte port number to each running application process.
b. Modify this protocol so that it provides a “return address” to the destination process.
c. In your protocols, does the transport layer “have to do anything” in the core of the computer network?
Answer:
a.称这个简单的运输层协议为STP,在发送端,STP接受应用程序要发送的数据(不超过1196字节),然后STP添加4字节头部信息,也就是端口号。将这1200字节的报文段连通目的地址交付给网络层;在接收端,STP提取端口和数据,将数据发送给端口所标志的程序。
b.在头部信息中增加 4 字节的源端口号,将数据减少为 1192 字节。也就是源端口号4字节,目的端口号4字节,数据1192字节。
c. 不需要,计算机网络核心是网络层的事情,因此运输层在网络核心中不需要做任何事。
解释:这里其实就是考察对运输层最基本功能的掌握。还有一点不太明白,为什么端口号是4字节呢?
R2. Consider a planet where everyone belongs to a family of six, every family lives in its own house, each house has a unique address, and each person in a given house has a unique name. Suppose this planet has a mail service that delivers letters from source house to destination house. The mail service requires that (1) the letter be in an envelope, and that (2) the address of the destination house (and nothing more) be clearly written on the envelope.
Suppose each family has a delegate family member who collects and distributes letters for the other family members. The letters do not necessarily provide any indication of the recipients of the letters.
a. Using the solution to Problem R1 above as inspiration, describe a protocol that the delegates can use to deliver letters from a sending family member to a receiving family member.
b. In your protocol, does the mail service ever have to open the envelope and examine the letter in order to provide its service?
Answer:
a. 可以使用R1中b的协议。发送信件时,写信的家庭成员是应用层,必须向家庭老大哥(也就是运输层)提供信件内容、目的住所地址和收件人姓名。老大哥在信的顶部清楚地写上收信人的姓名(也就是目的端口号)。然后,老大哥将信件放在信封中,并在信封上写下目的地房屋的地址(目的IP地址),再把信交给邮政服务。
在接收方,接受方老大哥从邮件服务部门接收信件,将信件从信封中取出,并记下写在信件顶部的收件人姓名(也就是源端口号),再将该信交给使用此名称的家庭成员。
b. 不,邮件服务不需要打开信封,它只检查信封上的地址。
R3. Consider a TCP connection between Host A and Host B. Suppose that the TCP segments traveling from Host A to Host B have source port number x and destination port number y. What are the source and destination port numbers for the segments traveling from Host B to Host A?
Answer:源端口号是x,目的端口号是y。
SECTION 3.4
R4. Describe why an application developer might choose to run an application over UDP rather than TCP.
Answer:
1)应用程序不需要使用TCP的拥塞控制,因为这可能导致应用程序的发送速率受限制
2)应用程序不需要TCP提供的可靠数据传输。
R5. Why is it that voice and video traffic is often sent over TCP rather than UDP in today’s
Internet? (Hint: The answer we are looking for has nothing to do with TCP’s congestion-control mechanism.
Answer:由于大多数防火墙配置为阻止UDP通信,因此将TCP用于视频和语音通信可以使通信通过防火墙。
解释:记住就好啦。
R6. Is it possible for an application to enjoy reliable data transfer even when the application runs over UDP? If so, how?
Answer: 这是可能的。开发人员可以将可靠的数据传输到应用层协议中。但这需要大量的工作和调试。
R8. Suppose that a Web server runs in Host C on port 80. Suppose this Web server uses persistent connections, and is currently receiving requests from two different Hosts, A and B. Are all of the requests being sent through the same socket at Host C? If they are being passed through different sockets, do both of the sockets have port 80? Discuss and explain.
答:
对于每个持久连接,Web服务器将创建一个单独的“连接套接字”。每个连接套接字由四个元组标识:(源IP地址、源端口号、目标IP地址、目标端口号)。当主机C接收IP数据报时,它会检查数据报/数据段中的这四个字段,以确定应将TCP数据段的有效负载传递到哪个套接字。因此,来自A和B的请求通过不同的套接字。这两个套接字的标识符的目标端口都为80;但是,这些套接字的标识符对于源IP地址具有不同的值。
与UDP不同,当传输层将TCP段的有效负载传递到应用程序进程时,它不会指定源IP地址,因为这是由套接字标识符隐式指定的。
R10. In our rdt protocols, why did we need to introduce timers定时器?
答:为了解决传输过程中的损耗。如果在计时器的持续时间内未接收到所发送包的ACK,则假定该包(或其ACK或NACK)已丢失。因此,数据包被重新传输。
也就是说,加入计时器,是为了让发送方确认分组丢失:如果发送方在确定时间内没有收到请求,则认为分组已经丢失,则会重发分组。
R11. Suppose that the roundtrip delay between sender and receiver is constant and known to the sender. Would a timer still be necessary in protocol rdt 3.0 , assuming that packets can be lost? Explain.
答:仍然需要,因为如果没有定时器,即使发送发知道了往返时延,仍然无法知道一个分组从发送时刻起,过了多久的时间。往返时延的确定只是能够更合理地设置这个倒计时计时器,而不能缺少这个计时器。(每个分组对应一个到机器计时器,即每次发送一个分组,就启动一个倒计时计时器,包括第一次分组和重传分组)。
P1. Suppose Client A initiates a Telnet session with Server S. At about the same time, Client B also initiates a Telnet session with Server S. Provide possible source and destination port numbers for
a. The segments sent from A to S.
b. The segments sent from B to S.
c. The segments sent from S to A.
d. The segments sent from S to B.
e. If A and B are different hosts, is it possible that the source port number in the segments from A to S is the same as that from B to S?
f. How about if they are the same host?
Answer:
设主机A的telnet会话端口号为x,主机B的telnet会话端口号为y
a. 源端口号:x,目的端口号:23
b. 源端口号:y,目的端口号:23
c. 源端口号:23,目的端口号:x
d. 源端口号:23,目的端口号:y
e. 可能相同
f. 不可能相同
P2. Consider Figure 3.5 . What are the source and destination port values in the segments flowing from the server back to the clients’ processes? What are the IP addresses in the network-layer datagrams carrying the transport-layer segments?
Answer:
服务器到客户A:
源端口号:80, 目的端口号:26145, 源IP:B, 目的IP:A
服务器到客户C,会话1:
源端口号:80, 目的端口号:7532, 源IP:B, 目的IP:C
服务器到客户C,会话2:
源端口号:80, 目的端口号:26145, 源IP:B, 目的IP:C
注意:这道题要仔细审题!是“flowing from the server back to the clients’ processes”,也就是从服务端到客户端的流向,不要看着图中的箭头稀里糊涂就写错了。
P3. UDP and TCP use 1s complement for their checksums. Suppose you have the following three 8-bit bytes: 01010011, 01100110, 01110100. What is the 1s complement of the sum of these 8-bit bytes? (Note that although UDP and TCP use 16-bit words in computing the checksum, for this problem you are being asked to consider 8-bit sums.) Show all work. Why is it that UDP takes the 1s complement of the sum; that is, why not just use the sum? With the 1s complement scheme, how does the receiver detect errors? Is it possible that a 1-bit error will go undetected? How about a 2-bit error
Answer:
反码为 11010001.
使用反码对接收方非常方便,只需将所有数据包含校验码加起来,计算和为全1即可。
如果不是全1则说明出现了差错。因此,为了检测错误,接收方应该包含四个字(三个原始字和校验和),且能够检测到所有的一位错误,但是不一定检测得到两位错误.
解释:我不明白,为了加的时候要把进位1也要算上?
虽然不明白,但是还是应该记住:计算checksum时,把所有16位的字相加,如果遇到进位,则将高于16字节的进位部分的值加到最低位上,举例,0xBB5E+0xFCED=0x1 B84B,则将1放到最低位,得到结果是0xB84C.
此外,还应仔细读这段的英文。
(1)one’s complement:反码(反码:正数的反码就是其原码;负数的反码是将原码中,除符号位以外,每一位取反。)
(2)two’s complement:补码(补码:正数的补码表示就是其本身,负数的补码就是取反加一)
P4.
a. Suppose you have the following 2 bytes: 01011100 and 01100101. What is the 1s complement of the sum of these 2 bytes?
b. Suppose you have the following 2 bytes: 11011010 and 01100101. What is the 1s complement of the sum of these 2 bytes?
c. For the bytes in part (a), give an example where one bit is flipped in each of the 2 bytes and yet the 1s complement doesn’t change
a. 00111110
b. 10111111
c. 两个字节的最后一位变化: 01011101 01100100
解释:omg最后一道没有看懂…
最后
以上就是飘逸小松鼠为你收集整理的《计算机网络自顶向下方法第7版》第三章习题解答的全部内容,希望文章能够帮你解决《计算机网络自顶向下方法第7版》第三章习题解答所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复