Transport-Layer Protocols:
UDP and TCP
Based on Data Communications and Networking (Chapter 24)
T S Pradeep kumar
VIT Chennai
April 11, 2026
T S Pradeep kumar Transport-Layer Protocols: UDP and TCP April 11, 2026 1 / 14
Outline
1 Introduction
2 User Datagram Protocol (UDP)
3 Transmission Control Protocol (TCP)
4 Summary
T S Pradeep kumar Transport-Layer Protocols: UDP and TCP April 11, 2026 2 / 14
Transport-Layer Protocols
The transport layer is located between the application layer and the
network layer.
It provides a process-to-process communication between two
application layers, acting as a liaison between a client program and a
server program.
Port Numbers: Port numbers provide end-to-end addresses at the
transport layer and allow multiplexing and demultiplexing.
Major Protocols in the Internet
1 UDP: An unreliable, connectionless transport-layer protocol.
2 TCP: A reliable, connection-oriented protocol.
3 SCTP: A newer protocol combining features of UDP and TCP.
T S Pradeep kumar Transport-Layer Protocols: UDP and TCP April 11, 2026 3 / 14
User Datagram Protocol (UDP)
Definition: UDP is a connectionless, unreliable transport protocol.
It does not add anything to the services of IP except for providing
process-to-process communication.
Connectionless Service: Each user datagram sent by UDP is an
independent datagram. There is no connection establishment or
termination.
Control: There is no flow control and no error control mechanism in
UDP except for an optional checksum.
T S Pradeep kumar Transport-Layer Protocols: UDP and TCP April 11, 2026 4 / 14
UDP Datagram Format
UDP packets, called user datagrams, have a fixed-size header of 8 bytes
made of four 2-byte fields.
Figure: UDP User Datagram Format [Fig 24.2]
Source/Destination Port Numbers: 16-bit fields defining the
processes.
Total Length: Defines the total length of the user datagram (header
+ data).
T S Pradeep kumar Transport-Layer Protocols: UDP and TCP April 11, 2026 5 / 14
UDP Applications
Why would a process want to use an unreliable protocol like UDP?
It is very simple and uses a minimum of overhead.
Ideal for a client-server application that needs to send a short request
and receive a quick response (e.g., DNS).
Suitable for a process with internal flow and error-control mechanisms
(e.g., TFTP).
Often used for interactive real-time applications (audio/video) that
cannot tolerate uneven delay caused by retransmitting lost packets.
Suitable for multicasting and network management (e.g., SNMP).
T S Pradeep kumar Transport-Layer Protocols: UDP and TCP April 11, 2026 6 / 14
Transmission Control Protocol (TCP)
Definition: TCP is a connection-oriented, reliable protocol.
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.
Buffers: Because sending and receiving processes may operate at
different rates, TCP uses a sending buffer and a receiving buffer.
Segments: At the transport layer, TCP groups a number of bytes
together into a packet called a segment.
Full-Duplex: Data can flow in both directions at the same time.
T S Pradeep kumar Transport-Layer Protocols: UDP and TCP April 11, 2026 7 / 14
TCP Numbering System
TCP keeps track of the segments using two fields: the sequence number
and the acknowledgment number. These refer to byte numbers, not
segment numbers.
Sequence Number
Defines the number assigned to the first byte of data contained in a
segment. During connection establishment, each party generates a random
Initial Sequence Number (ISN).
Acknowledgment Number
The acknowledgment number is cumulative. It defines the number of the
next byte a party expects to receive.
T S Pradeep kumar Transport-Layer Protocols: UDP and TCP April 11, 2026 8 / 14
TCP Segment Format
The TCP segment consists of a 20-to-60-byte header, followed by data.
Figure: TCP Segment Format [Fig 24.7]
T S Pradeep kumar Transport-Layer Protocols: UDP and TCP April 11, 2026 9 / 14
TCP Header Fields
Control Flags (6 bits): URG, ACK, PSH, RST, SYN, FIN. These
bits enable flow control, connection establishment/termination, and
data transfer modes.
Window Size: A 16-bit field defining the receiving window (rwnd)
size of the sending TCP, used for flow control. Maximum size is
65,535 bytes.
Checksum: A 16-bit mandatory field for error control (includes a
pseudoheader, the TCP header, and data).
Urgent Pointer: Used when the segment contains urgent data.
T S Pradeep kumar Transport-Layer Protocols: UDP and TCP April 11, 2026 10 / 14
TCP Connection Establishment
TCP transmits data in full-duplex mode using a connection-oriented
service. It uses a three-way handshake to establish a connection.
Figure: Connection Establishment using Three-Way Handshaking
Steps: 1) Client sends SYN. 2) Server responds with SYN + ACK. 3)
T S Pradeep kumar Transport-Layer Protocols: UDP and TCP April 11, 2026 11 / 14
TCP Connection Termination
To terminate a connection, TCP generally uses a three-way or four-way
handshaking process using the FIN flag.
Figure: Connection Termination using Handshaking
Either the client or server can issue an active close, triggering the
transmission of FIN and ACK segments.
T S Pradeep kumar Transport-Layer Protocols: UDP and TCP April 11, 2026 12 / 14
Flow Control and Windows in TCP
TCP uses a sliding window mechanism to achieve flow control, ensuring
the sender does not overwhelm the receiver.
The window size is determined by the receiver-advertised window size
(rwnd) or the congestion window size (cwnd), whichever is smaller.
The Send Window dictates how many bytes can be sent before
waiting for an acknowledgment.
The Receive Window controls the number of bytes that can be
safely received and buffered.
(The send window opens when an ACK arrives and closes/shrinks as data
is sent or buffer space fills up at the receiver).
T S Pradeep kumar Transport-Layer Protocols: UDP and TCP April 11, 2026 13 / 14
Summary
UDP provides a connectionless, unreliable datagram service using
minimum overhead (8-byte header).
TCP provides a reliable, connection-oriented, byte-stream service
with a 20-to-60-byte header.
TCP establishes connections via a three-way handshake (SYN,
SYN+ACK, ACK).
Reliability in TCP is achieved through sequence numbers, cumulative
acknowledgments, and timers.
Flow control in TCP is managed by a sliding window mechanism
dictated by the receiver’s buffer capabilities (rwnd).
T S Pradeep kumar Transport-Layer Protocols: UDP and TCP April 11, 2026 14 / 14