1. PART V: TRANSPORT LAYER
TRANSPORT-LAYER PROTOCOLS
Subject: Computer Networks
Tutor: Bilal Munir Mughal
1
Ch-24
2. Content Outline
INTRODUCTION
Services
Port Numbers
USER DATAGRAM PROTOCOL
User Datagram
UDP Services
UDP Applications
2
3. Content Outline
TRANSMISSION CONTROL PROTOCOL
TCP Services
TCP Features
Segment
A TCP Connection
State Transition Diagram
Windows in TCP
Flow Control
Error Control
TCP Congestion Control
TCP Timers
Options
3
4. Content Outline
SCTP
SCTP Services
SCTP Features
Packet Format
An SCTP Association
Flow Control
Error Control
4
5. INTRODUCTION
The transport layer in the TCP/IP suite is located
between the application layer and the network layer.
It provides services to the application layer and
receives services from the network layer.
The transport layer acts as a liaison between a client
program and a server program, a process-to-process
connection.
The transport layer is the heart of the TCP/IP protocol
suite; it is the end-to-end logical vehicle for
transferring data from one point to another in the
Internet.
5
7. SERVICES
UDP(User Datagram Protocol)
UDP is an unreliable connectionless transport-layer
protocol used for its simplicity and efficiency in
applications where error control can be provided by the
application-layer process.
TCP(Transmission Control Protocol)
TCP is a reliable connection-oriented protocol that can be
used in any application where reliability is important.
SCTP(Stream Control Transmission Protocol)
SCTP is a new transport-layer protocol that combines the
features of UDP and TCP.
7
8. PORT NUMBERS
Port numbers provide end-to-end addresses at the transport
layer and allow multiplexing and demultiplexing at this layer.
8
10. USER DATAGRAM PROTOCOL
Example 24.1
The following is the content of a UDP header in
hexadecimal format.
CB84000D001C001C
a. What is the source port number?
b. What is the destination port number?
c. What is the total length of the user datagram?
d. What is the length of the data?
e. Is the packet directed from a client to a server or vice
versa?
f. What is the client process?
10
11. USER DATAGRAM PROTOCOL
Solution
a. The source port number is the first four hexadecimal digits
(CB84)16, which means that the source port number is 52100.
b. The destination port number is the second four hexadecimal
digits (000D)16, which means that the destination port
number is 13.
c. The third four hexadecimal digits (001C)16 define the length
of the whole UDP packet as 28 bytes.
d. The length of the data is the length of the whole packet
minus the length of the header, or 28 − 8 = 20 bytes.
e. Since the destination port number is 13 (well-known port), the
packet is from the client to the server.
f. The client process is the Daytime (see Table 24.1)
11
12. USER DATAGRAM PROTOCOL:
UDP SERVICES
Process-to-Process Communication
Connectionless Services
No Flow Control
No Error Control except for the checksum
Checksum
No Congestion Control
Encapsulation and Decapsulation
Queuing
Multiplexing and Demultiplexing
12
13. USER DATAGRAM PROTOCOL:
UDP SERVICES
Checksum
UDP checksum calculation includes three sections: a
pseudoheader, the UDP header, and the data coming
from the application layer.
The pseudoheader is the part of the header of the IP
packet (discussed in Chapter 19) in which the user
datagram is to be encapsulated with some fields filled
with 0s.
If the checksum does not include the pseudoheader, a user
datagram may arrive safe and sound. However, if the IP
header is corrupted, it may be delivered to the wrong
host.
13
14. USER DATAGRAM PROTOCOL:
UDP SERVICES
The protocol field is added to ensure that the packet
belongs to UDP, and not to TCP.
The value of the protocol field for UDP is 17. If this value
is changed during transmission, the checksum calculation
at the receiver will detect it and UDP drops the packet. It
is not delivered to the wrong protocol.
14
15. USER DATAGRAM PROTOCOL:
UDP SERVICES
Optional Inclusion of Checksum
The sender of a UDP packet can choose not to
calculate the checksum. In this case, the checksum
field is filled with all 0s before being sent.
In the situation where the sender decides to calculate
the checksum, but it happens that the result is all 0s,
the checksum is changed to all 1s before the packet
is sent.
15
16. USER DATAGRAM PROTOCOL:
UDP APPLICATIONS
UDP is suitable for a process that requires simple
request-response communication with little concern
for flow and error control. It is not usually used for a
process such as FTP that needs to send bulk data
(see Chapter 26).
UDP is suitable for a process with internal flow- and
error-control mechanisms. For example, the Trivial
File Transfer Protocol (TFTP) process includes flow
and error control. It can easily use UDP.
16
17. USER DATAGRAM PROTOCOL:
UDP APPLICATIONS
UDP is a suitable transport protocol for multicasting.
Multicasting capability is embedded in the UDP
software but not in the TCP software.
UDP is used for management processes such as SNMP
(see Chapter 27).
UDP is used for some route updating protocols such as
Routing Information Protocol (RIP) (see Chapter 20).
UDP is normally used for interactive real-time
applications that cannot tolerate uneven delay
between sections of a received message (see Chapter
28).
17
18. TRANSMISSION CONTROL PROTOCOL
Transmission Control Protocol (TCP) is a connection-
oriented, reliable protocol.
TCP explicitly defines connection establishment,
data transfer, and connection teardown phases to
provide a connection-oriented service.
TCP uses a combination of GBN and SR protocols to
provide reliability.
To achieve this goal, TCP uses checksum (for error
detection), retransmission of lost or corrupted
packets, cumulative and selective acknowledgments,
and timers.
18
19. TRANSMISSION CONTROL PROTOCOL
TCP SERVICES
Process-to-Process Communication
Stream Delivery Service
Full-Duplex Communication
Multiplexing and Demultiplexing
Connection-Oriented Service
Reliable Service
19
20. TRANSMISSION CONTROL PROTOCOL
TCP SERVICES
Stream Delivery Service
TCP, allows the sending process to deliver data as a
stream of bytes and allows the receiving process to
obtain data as a stream of bytes.
20
23. TRANSMISSION CONTROL PROTOCOL
TCP FEATURES
Numbering System
Byte Number
TCP numbers all data bytes (octets) that are transmitted in a
connection. Numbering is independent in each direction.
The numbering does not necessarily start from 0. Instead, TCP
chooses an arbitrary number between 0 and 232 − 1 for the number
of the first byte.
Sequence Number
TCP assigns a sequence number to each segment that is being sent.
The sequence number, in each direction, is defined as follows:
1. The sequence number of the first segment is the ISN (initial
sequence number), which is a random number.
2. The sequence number of any other segment is the sequence
number of the previous segment plus the number of bytes
(real or imaginary) carried by the previous segment.
23
24. TRANSMISSION CONTROL PROTOCOL
TCP FEATURES
Numbering System…
Acknowledgment Number
The value of the acknowledgment field in a segment defines
the number of the next byte a party expects to receive.
The acknowledgment number is cumulative. which means that
the party takes the number of the last byte that it has received,
safe and sound, adds 1 to it, and announces this sum as the
acknowledgment number.
24
27. TRANSMISSION CONTROL PROTOCOL
TCP CONNECTION
In TCP, connection-oriented transmission requires three
phases:
connection establishment,
data transfer,
and connection termination.
27
32. TRANSMISSION CONTROL PROTOCOL
TCP CONNECTION
Connection Reset
TCP at one end may deny a connection request, may
abort an existing connection, or may terminate an
idle connection.
All of these are done with the RST (reset) flag.
32
35. TRANSMISSION CONTROL PROTOCOL
ERROR CONTROL
Error control in TCP is achieved through the use of
three simple tools:
Checksum
Acknowledgment
Cumulative Acknowledgment (ACK)
Selective Acknowledgment (SACK)
Retransmission
Retransmission after RTO(Retransmission time-out)
Retransmission after Three Duplicate ACK Segments
35
36. TRANSMISSION CONTROL PROTOCOL
ERROR CONTROL
TCP implementations today do not discard out-of-
order segments.
They store them temporarily and flag them as out-of-
order segments until the missing segments arrive.
36
39. TRANSMISSION CONTROL PROTOCOL
CONGESTION CONTROL
TCP uses different policies to handle the congestion in
the network.
Congestion Window
The TCP sender uses the occurrence of two events as signs
of congestion in the network: time-out and receiving three
duplicate ACKs.
The lack of regular, timely receipt of ACKs, which results
in a time-out, is the sign of a strong congestion; the
receiving of three duplicate ACKs is the sign of a weak
congestion in the network.
39
40. TRANSMISSION CONTROL PROTOCOL
CONGESTION CONTROL
Congestion Policies
Slow Start: Exponential Increase algorithm
Congestion Avoidance: Additive Increase algorithm
Fast Recovery algorithm
40
41. TRANSMISSION CONTROL PROTOCOL
CONGESTION CONTROL
Congestion Policies…
The fast-recovery algorithm is optional in TCP.
It starts when three duplicate ACKs arrive, which is
interpreted as light congestion in the network.
Like congestion avoidance, this algorithm is also an
additive increase, but it increases the size of the
congestion window when a duplicate ACK arrives (after
the three duplicate ACKs that trigger the use of this
algorithm)
41
42. TRANSMISSION CONTROL PROTOCOL
CONGESTION CONTROL
Three versions of TCP:
Taho TCP uses only slow start and congestion avoidance
Reno TCP added fast-recovery state
New Reno TCP added three duplicate ACKs arrive
42
43. TRANSMISSION CONTROL PROTOCOL
TCP TIMERS
To perform their operations smoothly, most TCP
implementations use at least four timers:
Retransmission Timer
Persistence Timer
Keepalive Timer
TIME-WAIT Timer
43
44. TRANSMISSION CONTROL PROTOCOL
OPTIONS
The TCP header can have up to 40 bytes of optional
information.
Options convey additional information to the
destination or align other options.
These options are included on the book website for
further reference.
44
45. STREAM CONTROL TRANSMISSION
PROTOCOL
Stream Control Transmission Protocol (SCTP) is a
new transport-layer protocol designed to combine
some features of UDP and TCP in an effort to create
a better protocol for multimedia communication.
45
46. STREAM CONTROL TRANSMISSION PROTOCOL:
SERVICES
Process-to-Process Communication
Multiple Streams
Multihoming
Full-Duplex Communication
Connection-Oriented Service
Reliable Service
46
47. STREAM CONTROL TRANSMISSION PROTOCOL:
SERVICES
Multiple Streams
SCTP allows multistream service in each connection,
which is called association in SCTP terminology.
If one of the streams is blocked, the other streams can still
deliver their data.
47
48. STREAM CONTROL TRANSMISSION PROTOCOL:
SERVICES
Multihoming
In TCP connection a multihomed host (connected to more
than one physical address with multiple IP addresses),
only one of these IP addresses per end can be utilized
during the connection.
An SCTP association, supports multihoming service. The
sending and receiving host can define multiple IP
addresses in each end for an association.
48
49. STREAM CONTROL TRANSMISSION PROTOCOL:
FEATURES
Acknowledgment Number
SCTP acknowledgment numbers are chunk-oriented. They refer
to the TSN.
Packets
49
52. STREAM CONTROL TRANSMISSION PROTOCOL:
ERROR CONTROL
SCTP, like TCP, is a reliable transport-layer protocol.
It uses a SACK chunk to report the state of the
receiver buffer to the sender.
Each implementation uses a different set of entities
and timers for the receiver and sender sites.
52
53. STREAM CONTROL TRANSMISSION PROTOCOL:
ERROR CONTROL
Congestion Control
SCTP, like TCP, is a transport-layer protocol with packets
subject to congestion in the network. The SCTP designers
have used the same strategies for congestion control as
those used in TCP.
53