Module 3 Tutorials & Solutions
Transport Layer (Forouzan Chapter 13)
Daniel Franklin
March 12, 2024
13.1 A sender sends a series of packets to the same destination using 5-bit sequence of num-
bers. If the sequence number starts with 0, what is the sequence number of the 100th packet?
A: Sequence numbers have 5 bits and start from zero. They will cycle from 00000 to 11111
and then the sequence repeats. So packets 1-32 will have sequence numbers from 0 to 31, then
this is repeated for 33-64, 65-96, and then 97, 98, 99, 100 will be 0, 1, 2, and 3. Therefore, the
sequence number is 3. You can also just calculate (start sequence number + packet number -
1) modulo 2nbits , in this case this is (0 + 100 - 1) modulo 32 = 3.
13.3 Show the finite state machine for an imaginary machine with three states: state A
(starting state), state B, and state C; and four events: events 1, 2, 3, and 4. The following
specify the behaviour of the machine:
1. When in state A, two events may occur: event 1 and event 2. If event 1 occurs, the
machine performs action 1 and moves to state B. If event 2 occurs, the machine moves to
state C (no action).
2. When in state B, two events may occur: event 3 and event 4. If event 3 occurs, the
machine performs action 2, but remains in state B. If event 4 occurs, the machine just
moves to state C.
3. When in state C, the machine remains in this state forever.
A: See Figure 1
Event 1
Event 3
Action 1
Action 2
Start A B
Event 2 Event 4
None None
C
Dead state
Figure 1: Foruzan problem 13.3
[htb]
13.5 Redraw Figure 2 with 5 packets exchanged (0, 1, 2, 3, 4). Assume packet 2 is lost and
packet 3 arrives after packet 4.
[htb]
1
Sender Receiver Events:
Transport Transport Req: Request came from process
layer layer pArr: Packet arrived
Req Packet
pArr
Req Packet
pArr
Time Time
Figure 2: Figure 13.18 (Foruzan problem 13.5)
A: Figure 3 shows the outline. Note that since the simple protocol provide no error control, if
a packet is lost, the receiving process is responsible to find a solution. The transport layer is
not even aware that this has [Link] packets may also be delivered out of order to the
receiving process. The responsibility again is on the receiving process to reorder the packets.
Sender Receiver
Transport Transport
layer layer
Req Packet 0
Packet 1 pArr
Req
Req Packet 2 pArr
Req Packe
t3 Lost
Packet 4
Req
pArr
pArr
Time Time
Figure 3: Foruzan problem 13.5
[htb]
13.7 Create a scenario similar to figure 13.21 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 resent.
A: See Figure 4
[htb]
13.9 Redraw Figure 13.34 if the sender sends 5 packets (0, 1, 2, 3, and 4). Packets 0, 1, and
2 are received in order and acknowledged, one by one. Packet 3 is delayed and received after
packet 4.
A: See Figure 5
[htb]
13.11 Answer the following questions related to the finite state machines for the Go-back-N
protocol with m = 6 (Figure 6):
2
Sender Receiver
Transport Transport
layer layer
Req Packet 0
Start 010101
pArr
ACK 1 01010 1
Timeout; restart T-Out Packet 0 (re
0101 sent)
pArr Packet 0
ACK 1 discarded
aArr (a duplicate)
Stop 0 1 01 0 1
Packet 1
Req
Start 0 1 01 0 1 Lost
T-Out Packet 1 (resent)
Timeout; restart 0 1 01 0 1 pArr
ACK 0 010101
aArr
Stop 0 1 01 0 1
Time Time
Figure 4: Foruzan problem 13.7
[htb]
1. The sending machine is in the ready state with Sf = 10 and Sn = 15. What is the sequence
number of the next packet to send?
2. The sending machine is in the ready state with Sf = 10 and Sn = 15. A time-out occurs.
How many packets are to be resent? What are their sequence numbers?
3. The sending machine is in the ready state with Sf = 10 and Sn = 15. An ACK with
ackNo = 13 arrives. What are the next values of Sf and Sn?
4. The sending machine is in the blocking state with Sf = 14 and Sn = 21. What is the size
of the window?
5. The sending machine is in the blocking state with Sf = 14 and Sn = 21. An ACK with
ackNo = 18 arrives. What are the next values of Sf and Sn? What is the state of the
sending machine?
6. The receiving machine is in the ready state with Rn = 16. A packet with sequence number
16 arrives. What is the next value of Rn? What is the response of the machine to this
event?
A:
1. seqNo = 15.
2. Five packets with seqNo set to 10, 11, 12, 13, and 14 are to be resent.
3. Sf = 13 and Sn = 15.
4. The size of the window remains the same. Max Wsize = 26 − 1 = 63.
5. Sf = 18 and Sn = 21 Next state = ready
6. Rn = 17 Action: an ACK with ackNo = 17 is sent.
14.1 In cases where reliability is not of primary importance, UDP would make a good trans-
port protocol. Give examples of specific cases.
A:
• Interactive voice / video over IP (Skype etc.)
• Broadcast TV over IP - multicast
3
Events:
Req: Request from process
pArr: Packet arrival Sender Receiver
aArr: ACK arrival
Transport Transport
T-Out: time out layer layer
Sf Sn Rn
Initial 01234567 0 Initial 0 1 2 3 4 5 6 7
Sf Sn
Req Rn
Start Packet 0
01234567 0 pArr
01234567
Sf Sn A CK 0
aArr Data delivered
Stop 01234567 0 to application
Sf Sn Rn
Req Packet 1
Start 01234567 0 pArr
01234567
Sf Sn A CK 1
aArr Data delivered
Stop 01234567 0 to application
Sf Sn
Req Packet 2 Rn
Start 01234567 0 pArr
01234567
Sf Sn A CK 2
aArr Data delivered
Stop 01234567 0 to application
Sf Sn
Req
Start 01234567 0 Pa
ck
et
3
Sf Sn
Req Packet 4 Rn
01234567 0 pArr
01234567
Sf Sn A CK 4
aArr Rn
Restart 01234567 0
pArr
01234567 0
Sf Sn A CK 3
aArr Data delivered
Stop 01234567 0 to application
Time Time
Figure 5: Foruzan problem 13.9
• Real-time gaming (e.g. multiplayer FPS)
• Local file distribution over a reliable network (or network filesystem)
14.3 Show the entries for the header of a UDP user datagram that carries a message from
a TFTP client to a TFTP server. Fill the checksum field with 0s. Choose an appropriate
ephemeral port number and the correct well-known port number. The length of data is 40
bytes. Show the UDP packet using the format in Figure 14.2.
A: See Figure 7
[htb]
14.5 A TFTP server residing on a host with IP address [Link] sends a message to a
TFTP client residing on a host with IP address [Link]. What is the pair of sockets used
in this communication?
A: The server would use the IP address [Link], combined with the well-known port number
69 for its source socket address and the IP address [Link], combined with an ephemeral
port number as the destination socket address.
14.7 A client uses UDP to send data to a server. The data length is 16 bytes. Calculate the
efficiency of this transmission at the UDP level (ratio of useful bytes to total bytes).
A: Efficiency = (16 bytes of data) / (24 bytes of total length) = 0.666 = 66.6 percent.
14.8/9 Redo Exercise 14.7, calculating the efficiency of transmission at the IP level. Assume
no options for the IP header.
4
Sender
Note:
All arithmetic equations Request from process came.
are in modulo 2m. Make a packet (seqNo =Sn) . Time-out.
Store a copy and send the packet. Resend all outstanding
Start the timer if it is not running. Window full packets.
Time-out. Sn =Sn +1. (Sn =Sf +SSize)? Restart the timer.
Resend all outstanding [true]
packets. [false]
Restart the timer.
Ready Blocking
A corruptedACK or an Error freeACK with ackNo between A corruptedACK or an
error-freeACK with ackNo Sf and Sn arrived. error-freeACK with ackNo
outsidewindow arrived. Slide window (Sf =ackNo). outsidewindow arrived.
Discard it. If ackNo equals Sn, stop the timer. Discard it.
If ackNo <Sn, restart the timer.
Receiver
Note: Error-freepacket with
All arithmetic equations seqNo =Rn arrived.
are in modulo 2m. Deliver message.
Slide window (Rn =Rn +1).
Send ACK (ackNo =Rn).
Ready Error-freepacket
Corrupted packet arrived. with seqNo ! =/ Rn arrived.
Discard packet. Discard packet.
Send an ACK (ackNo =Rn).
Figure 6: Foruzan problem 13.11
52010 69
48 0
Data
(40 bytes)
Figure 7: Foruzan problem 14.3
A: Efficiency = (16 bytes of data) / (16 (data) + 8 (UDP) + 20 (IP)) = 0.364 = 36.4%.
14.9 Redo Exercise 14.7, calculating the efficiency of transmission at the data link layer.
Assume no options for the IP header and use Ethernet at the data link layer.
A: Efficiency = (16 bytes of data) / (64-byte minimum frame size) = 0.25 = 25%.