MODULE 04
TRANSPORT & APPLICATION LAYER
17
Transport Layer

Process-to-Process Delivery: UDP & TCP

Transport Layer bridges Network Layer (host-to-host) and Application Layer. Uses port numbers for process-to-process communication. Two protocols: UDP (fast, unreliable) and TCP (reliable, connection-oriented).
UDP

User Datagram Protocol

Connectionless, unreliable, minimal overhead. No ACKs, no retransmissions, no ordering guarantee.
FieldSizePurpose
Source Port16 bitsSending process port
Destination Port16 bitsReceiving process port
Length16 bitsHeader + data length (bytes)
Checksum16 bitsError detection (optional IPv4, mandatory IPv6)

Use Cases

  • DNS queries (primarily)
  • VoIP / real-time streaming
  • Online gaming
  • DHCP, SNMP, TFTP
TCP

Transmission Control Protocol

Connection-oriented, reliable, stream-oriented, full-duplex. Uses sequence numbers, ACKs, sliding window.

6 Core Services

  • Process-to-process — port numbers
  • Stream delivery — byte stream with send/receive buffers
  • Full-duplex — bidirectional simultaneously
  • Multiplexing/Demultiplexing — per connection
  • Connection-oriented — 3 phases: establish → transfer → terminate
  • Reliable — ACK mechanism

Three-Way Handshake

CLIENT SERVER 1. SYN 2. SYN-ACK 3. ACK

TCP Header Key Fields

FieldSizePurpose
Source/Dest Port16 bits eachProcess identification
Sequence Number32 bitsByte-stream position
Ack Number32 bitsNext expected byte
Header Length4 bitsTCP header size in 32-bit words
Flags (SYN,ACK,FIN,RST,PSH,URG)6 bitsControl bits
Window Size16 bitsFlow control credit
Checksum16 bitsSegment + pseudoheader (IP/Protocol/Length)
Urgent Pointer16 bitsValid if URG flag set; offset to last urgent byte
OptionsUp to 40 bytesOptional info

TCP Connection Phases

  • Phase 1: Connection Establishment — 3-Way Handshake (SYN → SYN-ACK → ACK).
  • Phase 2: Data Transfer — Bidirectional byte-stream exchange with sequence numbers and windowing.
  • Phase 3: Connection Termination — Usually a 4-Way Handshake (FIN/ACK exchange) for graceful closure.

TCP Reliability Mechanisms

Ordering/Detection
Sequence numbers for ordering and duplicate detection.
Acknowledgments
Cumulative or selective ACKs to confirm delivery.
Lost Segments
Retransmission timers for recovery of missing data.
Flow & Congestion
Sliding window for flow control and algorithms for congestion.

UDP vs TCP — Quick Comparison

FeatureUDPTCP
ConnectionConnectionlessConnection-oriented
ReliabilityUnreliableReliable (ACKs, retrans)
OrderingNo guaranteeIn-order delivery
Flow ControlNoneSliding window
Congestion ControlNoneYes
Header Size8 bytes20-60 bytes
SpeedFasterSlower (overhead)
Use CaseStreaming, DNS, VoIPWeb, email, file transfer
Exam tip: UDP header = 8 bytes fixed. TCP header = 20 bytes minimum (up to 60 with options). TCP 3-way handshake: SYN → SYN-ACK → ACK. Connection termination: 4-way (FIN/ACK exchange).
18
Congestion & QoS

Congestion Control & Quality of Service

Congestion = load > capacity (too many sources, router buffers overflow). Congestion Control = keep load below capacity. Two categories: Open-Loop (prevention) and Closed-Loop (removal after it happens).
Open-Loop

Congestion Prevention (Before it happens)

PolicyDescriptionKey Point
RetransmissionOptimize retransmission timersTCP prevents/alleviates congestion
WindowSelective Repeat preferred over Go-Back-NGBN resends already-received packets → worsens congestion
AcknowledgmentSend fewer ACKs (ACK every N packets or timer-based)ACKs are part of network load
DiscardingDrop less sensitive packets during congestionE.g., discard some audio packets in VoIP
AdmissionQoS in virtual-circuit networksDeny new VC if congestion exists/likely
Closed-Loop

Congestion Removal (After it happens)

MethodDescriptionNetwork Type
BackpressureCongested node stops receiving from upstream node; propagates backwardVirtual circuit ONLY (knows upstream)
Choke PacketCongested router sends packet directly to sourceAny (goes direct to source)
Implicit SignallingSource infers congestion from symptoms (no ACK, delay)Any (no direct communication)
Explicit SignallingSignal included in data packets (forward or backward)Any
Key distinction: Backpressure = node-to-node, opposite data flow. Choke packet = router-to-source direct. Implicit = source guesses. Explicit = signal in data packets.
QoS

Quality of Service Parameters

ParameterDefinitionAcceptable Values
BandwidthMax transmission rate (bps)1080p: 3-5 Mbps; 4K: 15-25 Mbps
LatencyTotal travel time (propagation + transmission + processing + queuing)VoIP <150ms; Video <200ms
JitterVariation in packet arrival timesMinimize via jitter buffers
Packet Loss% of packets lostVoIP <1%; Video <0.1-0.5%
ReliabilityData arrives intact and orderedTCP ensures; UDP needs QoS guarantees
PriorityTraffic classification (DiffServ, MPLS)VoIP > file downloads
QoS

Need for Quality of Service

  • 1. Prevent Congestion: Stop high-bandwidth traffic from starving real-time traffic.
  • 2. Predictable Performance: Ensure consistent bandwidth, low latency, and minimal jitter.
  • 3. Improved UX: Avoid frozen screens, delayed audio, or dropped calls.
  • 4. Multi-App Support: Allocate resources so critical apps function despite background traffic.
  • 5. Differentiated Services: Prioritize premium services or critical flows (e.g., Enterprise VoIP).

QoS Mechanisms

  • Traffic Shaping — controls rate to prevent bursts
  • Traffic Policing — drops excess traffic beyond limits
  • Resource Reservation (RSVP) — reserves bandwidth along path
  • Packet Scheduling — WFQ, Priority Queuing
  • DiffServ — DSCP in IP headers for classification
  • IntServ — guaranteed bandwidth/latency per flow
Exam tip: Backpressure ONLY works in virtual-circuit networks (routers know upstream). In datagram networks, use choke packets or explicit/implicit signalling. QoS is essential for real-time apps (VoIP, video conferencing).
19
DNS & Email

Domain Name System, Remote Login & Email

DNS

Domain Name System

Translates human-readable domain names → IP addresses. Distributed, hierarchical database. Operates at Application Layer.

Resolution Process

  1. User types URL (e.g., google.com)
  2. Check local DNS cache
  3. Query DNS resolver (ISP)
  4. Recursive lookup: Root → TLD → Authoritative
  5. Authoritative server returns IP
  6. Client connects using IP

DNS Components

ComponentFunction
DNS ResolverClient-side intermediary; performs recursive lookups; maintains cache
Root Name ServersTop-level; direct queries to appropriate TLD server (no domain IPs)
TLD ServersManage .com, .org, .net, .edu; direct to authoritative server
Authoritative NSHolds definitive DNS records for a domain
DNS CacheTemporary storage at resolver, ISP, OS to reduce lookup time
Zone FilesContain DNS records (A, AAAA, MX, CNAME, NS, PTR)

DNS Record Types

A → IPv4 address
AAAA → IPv6 address
MX → Mail server
CNAME → Alias
NS → Name server
PTR → Reverse DNS
Remote Login

Telnet vs SSH

FeatureTelnetSSH
Port23 (TCP)22 (TCP)
SecurityPlaintext (INSECURE)Encrypted
AuthenticationPassword onlyPassword, public-key, MFA
UseLegacy/legacy systemsModern standard
AdditionalSFTP, port forwarding
Telnet transmits credentials in plaintext — vulnerable to eavesdropping. SSH is the secure replacement.
Email

Email Protocols: SMTP, POP3, IMAP, MIME

ProtocolPort(s)Purpose
SMTP25 (server), 587 (client), 465 (SSL)Sending emails
POP3110 (standard), 995 (SSL)Receiving — download to client, usually delete from server
IMAP143 (standard), 993 (SSL)Receiving — manage on server, sync across devices
MIMEMultimedia attachments, non-ASCII text

SMTP Operation

  1. Client connects to SMTP server (port 587)
  2. Sender provides credentials and message
  3. SMTP sends to recipient's SMTP server via TCP (port 25)
  4. Recipient server delivers to mailbox

POP3 vs IMAP

POP3
✓ Works offline
✓ Simple, minimal server load
✗ No multi-device sync
✗ Limited folder management
IMAP
✓ Centralized server storage
✓ Multi-device sync
✓ Folder management, flags, search
✗ Requires internet connection

MIME (Multipurpose Internet Mail Extensions)

ComponentFunction
Content-TypeSpecifies type of content (text, image, audio, video)
Content-Transfer-EncodingSpecifies encoding for safe transmission
MultipartAllows sending multiple parts (text + attachments) in one email
Exam tip: DNS is application layer. Telnet=23 (insecure), SSH=22 (secure). SMTP sends; POP3/IMAP receive. MIME enables attachments. IMAP keeps mail on server; POP3 downloads and removes.
20
Web & File Transfer

FTP, WWW & HTTP/HTTPS

FTP

File Transfer Protocol

Reliable file transfer between client and server over TCP. Uses two ports.
FeatureDetail
Control ConnectionPort 21 — commands (GET, PUT, LIST, DELETE, RENAME)
Data ConnectionPort 20 — actual file transfer
Active ModeServer connects to client for data
Passive ModeClient initiates both connections (firewall-friendly)
SecurityPlaintext credentials — use SFTP/FTPS instead
HTTP

Hypertext Transfer Protocol

HTTP

  • Port 80
  • Request-Response model
  • Stateless (no session memory)
  • Methods: GET, POST, PUT, DELETE

HTTPS

  • Port 443
  • SSL/TLS encryption
  • Confidentiality + Integrity + Authentication
  • Prevents MITM, eavesdropping
WWW

World Wide Web

ComponentDescription
Web BrowserClient app (Chrome, Firefox) — requests and renders content
Web ServerHosts content, responds to HTTP/HTTPS requests
URLAddress: protocol://domain/path
HTMLMarkup language for web pages
HyperlinksNavigation between pages/sites

Operation Flow

  1. User enters URL; Browser sends HTTP/HTTPS request.
  2. Server responds with page (HTML, CSS, JS, multimedia).
  3. Browser renders content and displays it.
  4. Additional resources (images/scripts) are requested separately.
Exam tip: FTP uses port 20 (data) + 21 (control). HTTP=80, HTTPS=443. WWW is a system of interlinked hypertext documents accessed via browsers. Stateless means each request is independent.
21
Network Mgmt

SNMP & Network Management

SNMP (Simple Network Management Protocol) = application-layer protocol to monitor, manage, and configure network devices (routers, switches, servers, printers).

SNMP Components

ComponentDescription
Managed DevicesNetwork elements with SNMP agents (routers, switches, servers)
SNMP AgentSoftware on managed device that collects/stores management info
NMSNetwork Management Station — central system monitoring all devices

SNMP Operations

GET
Retrieve information from managed device
SET
Modify configuration parameter
TRAP
Unsolicited notification from agent to NMS when significant event occurs (device failure, link down)
MIB

Management Information Base

  • Database of managed objects maintained by each device.
  • Each object = parameter/statistic (interface status, traffic counters).
  • Objects identified by Object Identifiers (OIDs).
SNMP Advantages
Centralized management, real-time monitoring/alerts, automated data collection.
SNMP Disadvantages
Plaintext in v1/2c (insecure), overhead from frequent polling, NMS resource intensive.
Exam tip: SNMP is application layer. Uses UDP ports 161 (agent) and 162 (traps). v1 and 2c lack strong security (plaintext). Trap = unsolicited alert from agent to manager.
22
Mail Transfer

SMTP — Detailed

SMTP = Simple Mail Transfer Protocol. Core protocol for mail transfer (client→server and server→server). TCP-based, store-and-forward model.

SMTP Ports

25 Server-to-server relay
587 Client submission (with auth)
465 SMTP over SSL (secure)

Mail Transfer Flow

MUA MTA 1 DNS MTA 2 587 MX 25 Sender Local Lookup Recipient
  1. Sender's MUA submits to local MTA via SMTP (port 587)
  2. Local MTA looks up recipient domain's MX record via DNS
  3. MTA establishes SMTP connection to recipient's MTA (port 25)
  4. Recipient MTA places message in user's mailbox
  5. Recipient retrieves using POP3 or IMAP

SMTP + Complementary Protocols

ProtocolRolePort
SMTPSend mail (MTA→MTA, MUA→MTA)25, 587, 465
POP3Retrieve mail (download)110, 995
IMAPRetrieve mail (server sync)143, 993
MIMEEncode multimedia content
Exam tip: SMTP uses DNS MX records to find recipient mail servers. Store-and-forward: if recipient server unavailable, message is queued and retried. MIME extends SMTP for non-text content.
P
Quick Ref

Protocol Port Reference

ProtocolPort(s)LayerTCP/UDP
DNS53ApplicationUDP/TCP
Telnet23ApplicationTCP
SSH22ApplicationTCP
SMTP25 587 465ApplicationTCP
POP3110 995ApplicationTCP
IMAP143 993ApplicationTCP
FTP20 21ApplicationTCP
HTTP80ApplicationTCP
HTTPS443ApplicationTCP
SNMP161 162ApplicationUDP
UDPTransportTransport
TCPTransportTransport
FC
Study Mode

Flashcards

Tap card to flip

Master Ref

Complete Cheatsheet

Every Key Fact in One Table

TopicKey Rule / Fact
Transport LayerProcess-to-process via port numbers. Bridges network and application layers.
UDPConnectionless, unreliable, 8-byte header, no congestion control. DNS, VoIP, gaming.
TCPConnection-oriented, reliable, 20-60 byte header, 3-way handshake, full-duplex.
3-Way HandshakeSYN → SYN-ACK → ACK
CongestionLoad > capacity. Open-loop = prevention. Closed-loop = removal.
BackpressureNode-to-node, opposite data flow. Virtual circuit networks ONLY.
Choke PacketRouter sends directly to source. Works in any network.
QoS ParametersBandwidth, Latency, Jitter, Packet Loss, Reliability, Priority
DNSApplication layer. Distributed hierarchical database. A=IPv4, AAAA=IPv6, MX=mail, CNAME=alias.
DNS ResolutionClient → Cache → Resolver → Root → TLD → Authoritative → IP
TelnetPort 23. Plaintext. Insecure. Replaced by SSH.
SSHPort 22. Encrypted. Supports SFTP and port forwarding.
SMTPPort 25/587/465. Sends mail. Store-and-forward. Uses MX records.
POP3Port 110/995. Downloads mail, usually deletes from server.
IMAPPort 143/993. Manages mail on server. Multi-device sync.
MIMEExtends email for attachments and non-ASCII text.
FTPPort 20 (data) + 21 (control). Active vs Passive mode.
HTTPPort 80. Stateless request-response.
HTTPSPort 443. SSL/TLS encrypted.
SNMPPort 161 (agent) / 162 (traps). Application layer. GET, SET, TRAP.
MIBManagement Information Base. Objects identified by OIDs.
Selective Repeat vs GBNSR better for congestion — only resends lost packets. GBN resends window.
Implicit vs Explicit SignallingImplicit = source guesses congestion. Explicit = signal in data packets.