Unit3
Unit3
User Datagram Protocol: User datagram, UDP services, UDP Applications, Transmission control
Protocol: TCP services, TCP features, Segment, A TCP connection, State transition diagram, Windows
in TCP, Flow control and error control, TCP Congestion control, TCP Timers, SCTP: SCTP services
SCTP features, packet format, An SCTP association, flow control, error control.
The Transport Layer is the fourth layer in the OSI (Open Systems Interconnection) model
and is responsible for providing end-to-end communication services for applications. The
transport layer ensures reliable data transfer between devices on different networks. It
establishes logical connections between the sender and receiver, manages data flow, and
provides services like error detection and recovery.
Port Numbers
Port numbers are used in the transport layer to identify specific processes or services running
on a device. A port number is a 16-bit number, so it ranges from 0 to 65535. They are
categorized as follows:
Well-known ports (0-1023): Reserved for widely used protocols (e.g., HTTP (80),
FTP (21), DNS (53)).
Registered ports (1024-49151): Used for applications that are not as widely
standardized.
Dynamic or private ports (49152-65535): Temporarily used for communication
between client and server during a session.
For example:
ADVANCED COMPUTER NETWORKS
User Datagram Protocol (UDP) is a connectionless, lightweight transport layer protocol that
offers minimal overhead. It is used in applications where speed is critical and reliability is not
as important, such as streaming video or DNS queries.
UDP Services
Connectionless: UDP does not establish a connection before sending data, reducing
delay.
Unreliable: UDP does not guarantee that packets will arrive or arrive in order, and it
does not perform retransmission or flow control.
No Flow Control: UDP does not manage the flow of data between sender and
receiver, leading to possible packet loss or congestion.
UDP Applications
UDP is used in applications where fast transmission is more important than reliability:
Streaming Media: Video and audio streaming (e.g., YouTube, VoIP) often use UDP
because real-time performance is prioritized over perfect delivery.
DNS: Domain Name System (DNS) requests are typically transmitted using UDP
because DNS queries are small and require fast responses.
Online Gaming: Many real-time multiplayer games use UDP to avoid latency caused
by retransmission and error-checking processes.
TCP Services
ADVANCED COMPUTER NETWORKS
Reliable Data Delivery: Ensures that data is received correctly and in order by using
acknowledgments and retransmissions.
Flow Control: Regulates the rate at which data is sent to avoid overwhelming the
receiver.
Congestion Control: Prevents network congestion by adjusting the sending rate
based on network conditions.
Error Detection and Correction: Uses checksums to detect errors in the data and
requests retransmission if necessary.
TCP Features
Segment
A TCP segment is the unit of data exchange in TCP, and it consists of:
A TCP Connection
1. SYN: The client sends a SYN (synchronize) packet to the server to initiate the
connection.
2. SYN-ACK: The server responds with a SYN-ACK packet, acknowledging the
connection request.
3. ACK: The client sends an ACK (acknowledgment) packet, completing the handshake.
Once the connection is established, data can flow between the client and server. The
connection is closed using a four-way handshake when communication is done.
The TCP state transition diagram illustrates the states a TCP connection can go through
during its lifecycle. Some key states include:
The transitions between these states are triggered by events like receiving packets, timeouts,
and acknowledgment of data.
Windows in TCP
TCP uses a concept called the sliding window for flow control. The window is a buffer that
allows the sender to transmit multiple packets before needing an acknowledgment, but only a
certain amount of data can be in transit at any given time.
The window size (advertised by the receiver) determines how much data can be sent
without waiting for an acknowledgment.
If the sender receives an acknowledgment, the window slides forward, and new data
can be sent.
Flow Control: Ensures the sender does not overwhelm the receiver. It’s managed
using the sliding window technique, which is adjusted based on the receiver’s buffer
space.
Error Control: Achieved using checksums for data integrity. If a packet is lost or
corrupted, TCP automatically retransmits it. Sequence numbers are used to ensure
the correct order of packets.
1. Slow Start: Initially, TCP sends a small amount of data and gradually increases the
sending rate as it gets acknowledgments.
2. Congestion Avoidance: If packet loss is detected (via timeout or duplicate ACKs),
TCP reduces the window size, slowing down the data transmission.
3. Fast Retransmit: If three duplicate ACKs are received (indicating packet loss), TCP
retransmits the lost packet immediately without waiting for a timeout.
4. Fast Recovery: TCP continues sending data after packet loss but adjusts the
congestion window to avoid further congestion.
TCP Timers
1. Retransmission Timer: Defines how long TCP should wait for an acknowledgment
before retransmitting a packet.
ADVANCED COMPUTER NETWORKS
2. Persist Timer: Ensures that the sender continues trying to send data when the
receiver’s window size is zero.
3. Keep-Alive Timer: Ensures that the connection is still alive by sending periodic
probes if no data is transmitted for a certain period.
SCTP is a transport layer protocol that combines features of both TCP and UDP. It is
connection-oriented like TCP, but it provides message-oriented communication like UDP.
SCTP is mainly used in applications requiring high availability and fault tolerance, such as
telecommunication networks.
SCTP Services
SCTP provides:
1. Reliable Message Delivery: Like TCP, it ensures messages are reliably delivered,
even in case of network failures.
2. Multihoming: SCTP supports multiple IP addresses for a single connection,
providing fault tolerance if one address becomes unavailable.
3. Ordered and Unordered Delivery: SCTP can deliver messages in the order they
were sent, or it can send them out of order, depending on the application’s needs.
SCTP Features
An SCTP Association
Flow Control: SCTP uses a similar sliding window mechanism as TCP to control the
flow of data.
Error Control: SCTP provides reliable data delivery by retransmitting lost packets,
using checksums for error detection, and ensuring that data is received in the correct
order.