FIT3165/FIT4165 Tutorial #3 TCP/IP Layered Architecture Week 4 – Semester 1 – 2022
02/03/2022
Revision Status
Updated by Dr. , Mar 2022.
Copyright By PowCoder代写 加微信 powcoder
©2022, Faculty of IT, Monash University
Instructions
1. Students will work individually to solve this week’s exercise.
2. Please answer all the review questions asked in Task 1.
Task 1 – Review Questions
Assume you need to write and test a client-server application program on two hosts you have at home.
a. What is the range of port numbers you would choose for the client program? b. What is the range of port numbers you would choose for the server program? c. Can the two port numbers be the same?
Solution: Although any port number can be used for the client and server and they can be the same in this private communication, it is recommended to follow the division specified by ICANN:
a. The client port number should be chosen from the dynamic range, 49,152 to 65,535.
b. The server port number also should be chosen from the dynamic range, 49,152 to 65,535.
c. It is advisable to choose different port numbers for the server and the client to be able to better debug the programs.
1.2. In a network, the size of the receive window is 1 packet. Which of the following protocols is being used by the network?
a. Stop-and-Wait b. Go-Back-N &
c. Selective-Repeat
Solution: We check each protocol one by one:
a. The protocol can be Stop-and-Wait with the receive window size of 1 and the send
window size of 1.
b. The protocol can also be Go-Back-N with the receive window size of 1 and the send window size of n packets.
c. The protocol cannot be Selective-Repeat because the size of both windows should be the same (1), which means the protocol is Stop-and-Wait, not Selective-Repeat.
©2022, Faculty of IT, Monash University
In a network with fixed value for windows size m > 1, we can use either the Go-Back N or the Selective-Repeat protocol. Describe the advantage and the disadvantage of using each. What other network criteria should be considered to select either of these protocols?
The advantage of using the Go-Back-N protocol is that we can have a larger send window size. We can send more packets before waiting for their acknowledgement. The disadvantage of using this protocol is that the receive window size is only 1. The receiver cannot accept and store the out- of-order received packets; they will be discarded. Discarding the out-of- order packets means resending these packets by the sender, resulting in congestion of the network and reducing the capacity of the pipe. So the advantage seen by a larger send window may disappear by filling the net- work with re-sent packets.
The advantage of using the Selective-Repeat protocol is that the receive window can be much larger than 1. This allows the receive window to store the out-of-order packets and avoids resending them to congest the network. On the other hand, the send window size of this protocol is half of the Go-Back- N, which means that we can send fewer packets before waiting for the acknowledgment.
If the bandwidth-delay product of the network is large, the reliability is good, and the delay is low, we should choose the Go-Back-N protocol to use more of the network capacity. On the other hand, if the bandwidth- delay product is small, and the network is not very reliable, or the network creates long delays, we need to use Selective-Repeat.
In the Go-Back-N protocol, the size of the send window can be 2m-1, while the size of the receive window is only 1. How can flow control be accomplished when there is a big difference between the size of the send and receive windows?
Solution: The rest of the packets (2m – 2) are supposed to be in transit, filling the pipe.
The size of the receive window is chosen to be 1 to accept only one packet, the one expected, and not out-of-order packets.
The receiver cannot be over- whelmed because it holds only one packet in its window. When the only packet in the window is consumed by the upper-layer protocol, the receive window slides to make it possible to receive the next packet in transit. If any packet in transit arrives before the window slides, it is discarded.
©2022, Faculty of IT, Monash University
Can you explain how TCP, which uses the services provided by the unreliable IP, can
provide reliable communication?
Solution: This is done through acknowledgment and retransmission. If a packet is lost or corrupted, it will be re-sent. As an analogy, assume the postal service is unreliable. When we send a letter to a friend, we can ask for confirmation with a postcard. If we do not receive the postcard, we can resend the copy of the letter until we finally get the confirmation.
1.6. In the Stop-and-Wait protocol, show the case in which the receiver receives a duplicate packet (which is also out of order). Hint: Think about a delayed ACK. What is the reaction of the receiver to this event?
Solution: The following shows the case. It happens when an ACK is delayed and the timeout occurs. The sender resends the packet that is already acknowledged by the receiver. The receiver
discards the duplicate
packet, but resends the previous ACK to inform the sender that there is a delay in the network.
Receiving a duplicate ACK
alert the sender to increase
the timeout to prevent
resending the packets
prematurely. Note that if
the receiver ignores the
duplicate packet and does
not send the second ACK,
the sender believes that
the first packet is lost and
the first ACK is actually acknowledging the packet that is re-sent. Duplicate ACKs give the clue about what is happening.
©2022, Faculty of IT, Monash University
We can define the bandwidth-delay product in a network as the number of packets that can be in the pipe during the round-trip time (RTT). What is the bandwidth-delay product in each of the following situations?
Solution: In each case we first define the bandwidth-delay product (BDP) in bits and then find it in the number of packets:
a. BDP = 1 Mbps × 20 ms = 20,000 bits = 20 packets
b. BDP = 10 Mbps × 20 ms = 200,000 bits = 100 packets
c. BDP = 1 Gbps × 4 ms = 4,000,000 bits = 400 packets
Can you explain why some transport-layer packets may be lost in the Internet?
Solution: The transport-layer packets are encapsulated in the datagram at the network layer. The router through which the datagrams need to pass to reach their destination may be congested and drop the packets.
Using 5-bit sequence numbers, what is the maximum size of the send-receive windows for each of the following protocols.
a. Stop-and-Wait b. Go-Back-N
c. Selective-Repeat
a. Stop-and-Wait: Wsize = 1; Wsize = 1
b. Go-Back-N: Wsize = 25 − 1 = 31; Wsize = 1
c. Selective-Repeat: Wsize = 25 / 2 = 16; Wsize = 25 / 2 = 16
a. Bandwidth: 1 Mbps,
b. Bandwidth: 10 Mbps,
c. Bandwidth: 1 Gbps,
RTT: 20 ms, RTT: 20 ms, RTT: 4 ms,
packet size: 1000 bits packet size: 2000 bits packet size: 10,000 bits
©2022, Faculty of IT, Monash University
1.10. Some of the application programs can use the services of two transport-layer protocols (UDP or TCP). When a packet arrives at the destination, how can the computer find which transport layer is involved?
Solution: The protocol field of the datagram (see Figures 4.24 and 4.25 in Chapter 4) defines the transport-layer protocol that should receive the transport-layer packet. If the value is 06, the protocol is TCP; if the value is 17, the protocol is UDP.
1.11. Looking at the TCP header (Figure 1.11), we find that the sequence number is 32 bits long, while the window size is only 16 bits long. Does this mean that TCP is closer to the Go-Back-N or Selective-Repeat protocol in this respect?
Figure 1.11
Solution: We cannot say. The size of the window field makes the size of the window 216 bytes, but the sequence number is 232. The size of the window is definitely much smaller (actually 216 times smaller) than half of the range of the sequence numbers.
©2022, Faculty of IT, Monash University
The requirement of each protocol, Go-Back-N and Selective-Repeat, is satisfied. However, TCP is closer to Selective-Repeat in other aspects.
1.12. Create a scenario similar to Figure 1.12 in which the sender sends two packets. The first packet is received and acknowledged, but the acknowledgement is lost. The sender resends the packet after time-out. The second packet is lost and will be resent.
Figure 1.12
©2022, Faculty of IT, Monash University
©2022, Faculty of IT, Monash University
1.13. Redraw Figure 1.13 if the sender sends 5 packets (0, 1, 2, 3, and 4). Packet 1, and 2 are received in order and acknowledged, one by one. Packet 3 delayed and received after packet 4.
Figure 1.13
©2022, Faculty of IT, Monash University
©2022, Faculty of IT, Monash University
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com