《第三章课后习题及答案(共17页).docx》由会员分享,可在线阅读,更多相关《第三章课后习题及答案(共17页).docx(17页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、精选优质文档-倾情为你奉上第三章1. (Q1) 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 laye
2、r 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
3、 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. Call this protocol Simpl
4、e Transport Protocol (STP). At the sender side, STP accepts from the sending process a chunk of data not exceeding 1196 bytes, a destination host address, and a destination port number. STP adds a four-byte header to each chunk and puts the port number of the destination process in this header. STP
5、then gives the destination host address and the resulting segment to the network layer. The network layer delivers the segment to STP at the destination host. STP then examines the port number in the segment, extracts the data from the segment, and passes the data to the process identified by the po
6、rt number. b. The segment now has two header fields: a source port field and destination port field. At the sender side, STP accepts a chunk of data not exceeding 1192 bytes, a destination host address, a source port number, and a destination port number. STP creates a segment which contains the app
7、lication data, source port number, and destination port number. It then gives the segment and the destination host address to the network layer. After receiving the segment, STP at the receiving host gives the application process the application data and the source port number. c. No, the transport
8、layer does not have to do anything in the core; the transport layer “lives” in the end systems.2. (Q2) 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 p
9、lanet has a mail service that delivers letters form source house to destination house. The mail service requires that (i) the letter be in an envelope and that (ii) the address of the destination house (and nothing more ) be clearly written on the envelope. Suppose each family has a delegate family
10、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 Q1 above as inspiration, describe a protocol that the delegates can use to deliver letters from a sending
11、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. For sending a letter, the family member is required to give the delegate the letter itself, the address of the destin
12、ation house, and the name of the recipient. The delegate clearly writes the recipients name on the top of the letter. The delegate then puts the letter in an envelope and writes the address of the destination house on the envelope. The delegate then gives the letter to the planets mail service. At t
13、he receiving side, the delegate receives the letter from the mail service, takes the letter out of the envelope, and takes note of the recipient name written at the top of the letter. The delegate than gives the letter to the family member with this name.b. No, the mail service does not have to open
14、 the envelope; it only examines the address on the envelope.3. (Q3) Describe why an application developer might choose to run an application over UDP rather than TCP.Answer: An application developer may not want its application to use TCPs congestion control, which can throttle the applications send
15、ing rate at times of congestion. Often, designers of IP telephony and IP videoconference applications choose to run their applications over UDP because they want to avoid TCPs congestion control. Also, some applications do not need the reliable data transfer provided by TCP.4. (P1) Suppose Client A
16、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 segment sent from A to B. b. The segment sent from B to S. c. The segment sent from S to A. d. The segment sent fr
17、om S to B. e. If A and B are different hosts, is it possible that the source port number in the segment from A to S is the same as that from B to S? f. How about if they are the same host?Answer:source port numbersdestination port numbersaA S46723bB S51323cS A23467dS B23513e Yes.f No.5. (P2) Conside
18、r Figure 3.5 What are the source and destination port values in the segments flowing form the server back to the clients processes? What are the IP addresses in the network-layer datagrams carrying the transport-layer segments?Answer:Suppose the IP addresses of the hosts A, B, and C are a, b, c, res
19、pectively. (Note that a,b,c are distinct.)To host A: Source port =80, source IP address = b, dest port = 26145, dest IP address = aTo host C, left process: Source port =80, source IP address = b, dest port = 7532, dest IP address = cTo host C, right process: Source port =80, source IP address = b, d
20、est port = 26145, dest IP address = c6. (P3) UDP and TCP use 1s complement for their checksums. Suppose you have the following three 8-bit bytes: , , . 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 prob
21、lem 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 sue 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
22、?Answer:0 1 0 1 0 1 0 1+0 1 1 1 0 0 0 01 1 0 0 0 1 0 11 1 0 0 0 1 0 1+0 1 0 0 1 1 0 00 0 0 1 0 0 0 1 Ones complement = 1 1 1 0 1 1 1 0.To detect errors, the receiver adds the four words (the three original words and the checksum). If the sum contains a zero, the receiver knows there has been an erro
23、r. All one-bit errors will be detected, but two-bit errors can be undetected (e.g., if the last digit of the first word is converted to a 0 and the last digit of the second word is converted to a 1).7. (P4) Suppose that the UDP receiver computes the Internet checksum for the received UDP segment and
24、 finds that it matches the value carried in the checksum field. Can the receiver be absolutely certain that no bit errors have occurred? Explain.Answer:No, the receiver cannot be absolutely certain that no bit errors have occurred. This is because of the manner in which the checksum for the packet i
25、s calculated. If the corresponding bits (that would be added together) of two 16-bit words in the packet were 0 and 1 then even if these get flipped to 1 and 0 respectively, the sum still remains the same. Hence, the 1s complement the receiver calculates will also be the same. This means the checksu
26、m will verify even if there was transmission error.8. (P5) a. Suppose you have the following 2 bytes: and . What is the 1s complement of sum of these 2 bytes?b. Suppose you have the following 2 bytes: and . What is the 1s complement of sum of these 2 bytes? c. For the bytes in part (a), give an exam
27、ple where one bit is flipped in each of the 2 bytes and yet the 1s complement doesnt change.Answer:a. Adding the two bytes gives . Taking the ones complement gives b. Adding the two bytes gives ; the ones complement gives .c. first byte = ; second byte = .9. (P6) Consider our motivation for correcti
28、ng protocol rdt2.1. Show that the receiver, shown inthe figure on the following page, when operating with the sender show in Figure 3.11, can lead the sender and receiver to enter into a deadlock state, where each is waiting for an event that will never occur.Answer: Suppose the sender is in state “
29、Wait for call 1 from above” and the receiver (the receiver shown in the homework problem) is in state “Wait for 1 from below.” The sender sends a packet with sequence number 1, and transitions to “Wait for ACK or NAK 1,” waiting for an ACK or NAK. Suppose now the receiver receives the packet with se
30、quence number 1 correctly, sends an ACK, and transitions to state “Wait for 0 from below,” waiting for a data packet with sequence number 0. However, the ACK is corrupted. When the rdt2.1 sender gets the corrupted ACK, it resends the packet with sequence number 1. However, the receiver is waiting fo
31、r a packet with sequence number 0 and (as shown in the home work problem) always sends a NAK when it doesnt get a packet with sequence number 0. Hence the sender will always be sending a packet with sequence number 1, and the receiver will always be NAKing that packet. Neither will progress forward
32、from that state.10. (P7) Draw the FSM for the receiver side of protocol rdt3.0Answer: The sender side of protocol rdt3.0 differs from the sender side of protocol 2.2 in thattimeouts have been added. We have seen that the introduction of timeouts adds the possibility of duplicate packets into the sen
33、der-to-receiver data stream. However, the receiver in protocol rdt.2.2 can already handle duplicate packets. (Receiver-side duplicates in rdt 2.2 would arise if the receiver sent an ACK that was lost, and the sender then retransmitted the old data). Hence the receiver in protocol rdt2.2 will also wo
34、rk as the receiver in protocol rdt 3.0.11. (P8) In protocol rdt3.0, the ACK packets flowing from the receiver to the sender do not have sequence numbers (although they do have an ACK field that contains the sequence number of the packet they are acknowledging). Why is it that our ACK packets do not
35、require sequence numbers?Answer: To best Answer this question, consider why we needed sequence numbers in the firstplace. We saw that the sender needs sequence numbers so that the receiver can tell if a data packet is a duplicate of an already received data packet. In the case of ACKs, the sender do
36、es not need this info (i.e., a sequence number on an ACK) to tell detect a duplicate ACK. A duplicate ACK is obvious to the rdt3.0 receiver, since when it has received the original ACK it transitioned to the next state. The duplicate ACK is not the ACK that the sender needs and hence is ignored by t
37、he rdt3.0 sender.12. (P9) Give a trace of the operation of protocol rdt3.0 when data packets and acknowledgment packets are garbled. Your trace should be similar to that used in Figure 3.16Answer: Suppose the protocol has been in operation for some time. The sender is in state “Waitfor call from abo
38、ve” (top left hand corner) and the receiver is in state “Wait for 0 from below”. The scenarios for corrupted data and corrupted ACK are shown in Figure 1.13. (P10) Consider a channel that can lose packets but has a maximum delay that is known. Modify protocol rdt2.1 to include sender timeout and ret
39、ransmit. Informally argue why your protocol can communicate correctly over this channel.Answer: Here, we add a timer, whose value is greater than the known round-trip propagation delay. We add a timeout event to the “Wait for ACK or NAK0” and “Wait for ACK or NAK1” states. If the timeout event occur
40、s, the most recently transmitted packet is retransmitted. Let us see why this protocol will still work with the rdt2.1 receiver. Suppose the timeout is caused by a lost data packet, i.e., a packet on the senderto- receiver channel. In this case, the receiver never received the previous transmission
41、and, from the receivers viewpoint, if the timeout retransmission is received, it look exactly the same as if the original transmission is being received. Suppose now that an ACK is lost. The receiver will eventually retransmit the packet on a timeout. But a retransmission is exactly the same action
42、that is take if an ACK is garbled. Thus the senders reaction is the same with a loss, as with a garbled ACK. The rdt 2.1 receiver can already handle the case of a garbled ACK.14. (P11) Consider the rdt3.0 protocol. Draw a diagram showing that if the network connection between the sender and receiver
43、 can reorder messages (that is, that two messages propagating in the medium between the sender and receiver can be reordered), then the alternating-bit protocol will not work correctly (make sure you clearly identify the sense in which it will not work correctly). Your diagram should have the sender
44、 on the left and the receiver on the right, with the time axis running down the page, showing data (D) and acknowledgement (A) message exchange. Make sure you indicate the sequence number associated with any data or acknowledgement segment.Answer:15. (P12) The sender side of rdt3.0 simply ignores (t
45、hat is, takes no action on) all received packets that are either in error or have the wrong value in the ack-num field of an acknowledgement packet. Suppose that in such circumstances, rdt3.0 were simply to retransmit the current data packet . Would the protocol still work? (hint: Consider what woul
46、d happen if there were only bit errors; there are no packet losses but premature timeout can occur. Consider how many times the nth packet is sent, in the limit as n approaches infinity.) Answer: The protocol would still work, since a retransmission would be what would happen if the packet received
47、with errors has actually been lost (and from the receiver standpoint, it never knows which of these events, if either, will occur). To get at the more subtle issue behind this question, one has to allow for premature timeouts to occur. In this case, if each extra copy of the packet is ACKed and each
48、 received extra ACK causes another extra copy of the current packet to be sent, the number of times packet n is sent will increase without bound as n approaches infinity.16. (P13) Consider a reliable data transfer protocol that uses only negative acknowledgements. Suppose the sender sends data only infrequently. Would a NAK-only protocol be preferable to a protocol that uses ACKs? Why? Now suppose the sender has a lot of data to send and the end to end connection experiences few losses. In this second case , would a NAK-only protocol be preferable to a protocol t