Intelligent Systems Engineering Department
The National School of Artificial Intelligence
3rd Year, Semester 1 — 2024/2025
NETWORKS AND PROTOCOLS
Exercises Sheet 5
Exercise 1
(a) Why would you want to use TCP over UDP?
(b) Why would you want to use UDP over TCP?
(c) Why does UDP exist? Couldn’t IP have been used instead for data transfer?
(d) Which fields in the UDP/TCP header change during packet routing?
(e) What does the TCP transmission window allow? What are its special features?
(f) Can a TCP module handle several connections simultaneously? If so, how can these
connections be distinguished?
(g) A TCP connection is established by exchanging three-way handshakes.
a) Why three messages? Wouldn’t two have been enough?
b) Recall the messages exchanged on a diagram, specifying the fields essential to the
establishment.
(h) Why doesn’t the numbering start at 0?
(i) Consider TCP operating on a 1 Gbit/s link. How long does it take for the sequence number
to loop back completely?
Exercise 2
The TCP exchange shown in the figure 1 corresponds to the transfer of a WEB page between a
WEB browser and a WEB server. It is assumed that the request to the WEB page is 100 bytes
and that the WEB page returned is 1000 bytes. There are no transmission errors. For each data
segment, different information are displayed.
The indicators such as SYN, FIN, ACK have been mentionned, and the number in brackets
corresponds to the total number bytes transmitted in the segment.
If the segment has a positive acknowledgement, the ACK flag is displayed and next to it the the
value of the TCP segment acknowledgement field.
Figure 1: Exercise 2
Exercise 3
Complete the sequence and acknowledgment numbers:
Figure 2: Exercise 3
Exercise 4
Host A and B are communicating over a TCP connection, and Host B has already received
from A all bytes up through byte 126. Suppose Host A then sends two segments to Host B
back-to-back. The first and second segments contain 80 and 40 bytes of data, respectively. Host
B sends an acknowledgment whenever it receives a segment from Host A. Complete the sequence
and acknowledgment numbers:
Figure 3: Exercise 4
Exercise 5
The following is a dump of a UDP header in hexadecimal form:
06 32 00 0D 00 1C E2 17
a) Source port number
b) Destination port number
c) Total length of the UDP
d) Length of tha data
e) Considering that an IP frame can have a maximum total length of 65 535 bytes, what is
the maximum length of the data in a UDP frame?
Exercise 6
Host A opens a TCP connection to host B, and starts sending a file of size F = 10 bytes, in
segments of size MSS = 1 byte each. As a result of a faulty link, the 5-th packet (without
counting the SYN packet in the TCP handshake) transmitted by A is lost.
i) The transmission delay for packets is negligible.
ii) The round-trip time between A and B is RT T1 .
iii) The retransmission timer of host A has a fixed duration equal to 2 ∗ RT T1 .
iv) TCP has Fast Retransmit disabled.
v) TCP receiver sends an ACK for each packet it receives.
vi) The first segment that A transmits will have a sequence number of 1.
vii) B stores (does not discard) all out-of-order packets.
Considering the above assumptions, complete the sequence diagram in Figure 4 with all packets
exchanged between A and B (we have completed part of the diagram to help you get started.)
timeout
for pkt 5
Figure 4: Exercise 6