8 Transport And Application Layer Protocols

Network and Data Communications · Unit 8

Transport and Application Layer Protocols

Exam-focused notes for Transport and Application Layer Protocols (Network and Data Communications, BIT254): what the TU syllabus asks and how it has actually been tested, with 6 solved past questions from this unit.

Transport and Application Layer Protocols in short

The transport layer carries data between programs on different hosts. The application layer holds the protocols users meet every day. This chapter covers TCP, UDP, sliding windows, FTP, HTTP and SNMP.

Transport and Application Layer Protocols: notes

TCP protocol characteristics

TCP (Transmission Control Protocol) is a connection-oriented, reliable transport protocol.

  • Connection-oriented: a connection is set up with a three-way handshake (SYN, SYN+ACK, ACK) and closed after use.
  • Reliable: lost or damaged segments are found by ACKs and timers and are sent again.
  • Stream based: data is seen as a stream of bytes, and each byte has a sequence number.
  • Full duplex: data moves in both directions at the same time.
  • Flow control: a sliding window keeps the sender from overwhelming the receiver.
  • Congestion control: the sender slows down when the network is busy.
  • Ordered: segments are put back in order at the receiver.

The TCP header is at least 20 bytes. It holds source and destination ports, sequence number, acknowledgement number, flags (SYN, ACK, FIN, RST), window size and checksum.

UDP user datagram format

UDP (User Datagram Protocol) is a connectionless, unreliable protocol. It sends independent datagrams with no setup, no ACK and no resend.

The UDP header is only 8 bytes, with four fields of 16 bits each:

FieldSizeMeaning
Source port16 bitsPort of the sending program
Destination port16 bitsPort of the receiving program
Length16 bitsHeader plus data, in bytes
Checksum16 bitsError check (optional in IPv4)

Example: a datagram with 100 bytes of data has Length $= 8 + 100 = 108$.

UDP is fast and light. It is used for DNS, DHCP, SNMP, streaming and voice calls.

What this unit covers

  • TCP protocol characteristics
  • UDP user datagram format
  • UDP ports
  • TCP vs UDP differences
  • TCP reliability mechanisms
  • Sliding Window Protocol
  • FTP protocol and operation
  • HTTP protocol
  • SNMP protocol and operation

TCP reliability mechanisms

2082 · 10 marks

Why TCP is known as reliable protocol? Explain.Divide the network 192.168.1.0/24 into 8 subnets and find its subnet ID, subnet mask, broadcast address and network ranges of each.[2+8]

Show solved answer

TCP as a Reliable Protocol & Subnetting

Given

  • Network: 192.168.1.0/24
  • Original subnet mask: 255.255.255.0
  • Required number of subnets: 8

Solution

(a) Why TCP is a Reliable Protocol?

TCP (Transmission Control Protocol) is called reliable because it guarantees accurate, ordered, and complete delivery of data through the following mechanisms:

  1. Connection-Oriented: Establishes a connection via a 3-way handshake (SYN, SYN-ACK, ACK) before data transfer.
  2. Acknowledgement (ACK): Receiver acknowledges received segments; unacknowledged segments are retransmitted after timeout.
  3. Error Detection (Checksum): Corrupted segments are detected and discarded, then retransmitted.
  4. Sequencing: Sequence numbers allow reordering of out-of-order segments and detection of lost data.
  5. Flow Control: A sliding window prevents overwhelming the receiver.
  6. Congestion Control: Adjusts transmission rate to avoid network congestion and packet loss.

Hence, TCP ensures no data is lost, duplicated, or delivered out of order.


(b) Subnetting 192.168.1.0/24 into 8 Subnets

Step 1 - Subnet bits needed: $$2^n \geq 8 \implies 2^3 = 8 \implies n = 3 \text{ bits}$$

Step 2 - New prefix and mask: $$/24 + 3 = /27$$

4th octet: $11100000_2 = 224$

$$\text{Subnet Mask} = 255.255.255.224$$

Step 3 - Block size: $$256 - 224 = 32 \text{ addresses per subnet (30 usable hosts)}$$

Step 4 - Subnet Table:

SubnetSubnet IDSubnet MaskFirst HostLast HostBroadcast
1192.168.1.0255.255.255.224192.168.1.1192.168.1.30192.168.1.31
2192.168.1.32255.255.255.224192.168.1.33192.168.1.62192.168.1.63
3192.168.1.64255.255.255.224192.168.1.65192.168.1.94192.168.1.95
4192.168.1.96255.255.255.224192.168.1.97192.168.1.126192.168.1.127
5192.168.1.128255.255.255.224192.168.1.129192.168.1.158192.168.1.159
6192.168.1.160255.255.255.224192.168.1.161192.168.1.190192.168.1.191
7192.168.1.192255.255.255.224192.168.1.193192.168.1.222192.168.1.223
8192.168.1.224255.255.255.224192.168.1.225192.168.1.254192.168.1.255

Summary:

ParameterValue
Original Network192.168.1.0/24
Subnets8
Bits Borrowed3
New Prefix/27
Subnet Mask255.255.255.224
Block Size32 addresses
Usable Hosts30 per subnet
Open this answer on its own page →

Sliding Window Protocol

2082 · 5 marks

Write Short notes on: Sliding Window Protocol HTTP Protocol [0+2.5+2.5]

Show solved answer

Short Notes

1. Sliding Window Protocol

The Sliding Window Protocol is a flow control and error control mechanism used in data link layer and transport layer protocols to allow efficient transmission of multiple frames before requiring acknowledgment.

Key Concepts

  • Instead of sending one frame and waiting for an ACK (as in Stop-and-Wait), the sender can transmit multiple frames up to a window size W without waiting for acknowledgment.
  • The window represents the number of frames that can be outstanding (sent but not yet acknowledged) at any time.
  • Both sender and receiver maintain a window of sequence numbers.

Working Principle

Sender Window (W=4):
[0][1][2][3] --> can send these without ACK
     ^--- as ACKs arrive, window slides forward
  • When an ACK is received for a frame, the window slides forward, allowing new frames to be sent.
  • Sequence numbers are used cyclically; for a window size W, sequence numbers range from 0 to 2^n - 1 (where n is the number of bits).

Types

TypeDescription
Go-Back-NOn error, retransmit the erroneous frame and all subsequent frames
Selective RepeatOnly the erroneous frame is retransmitted

Advantages

  • Increases link utilization and throughput
  • Reduces idle time compared to Stop-and-Wait
  • Efficiency = W / (1 + 2a), where a = propagation delay / transmission time

2. HTTP Protocol (HyperText Transfer Protocol)

HTTP is an application layer protocol used for transferring hypermedia documents (HTML, images, etc.) on the World Wide Web. It follows a client-server model.

Key Features

  • Stateless Protocol: Each request is independent; the server does not retain session information between requests.
  • Default Port: 80 (HTTP), 443 (HTTPS)
  • Connection Types:
    • Non-persistent HTTP: A new TCP connection is established for each object/request.
    • Persistent HTTP: Multiple objects can be sent over a single TCP connection.

HTTP Request Methods

MethodPurpose
GETRetrieve a resource
POSTSubmit data to the server
PUTUpdate a resource
DELETEDelete a resource
HEADRetrieve headers only

HTTP Message Format

Request:

GET /index.html HTTP/1.1
Host: www.example.com
Connection: keep-alive

Response:

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1024

<html>...</html>

HTTP Status Codes

CodeMeaning
200OK (Success)
301Moved Permanently
404Not Found
500Internal Server Error

HTTP Versions

  • HTTP/1.0: Non-persistent by default
  • HTTP/1.1: Persistent connections, pipelining supported
  • HTTP/2: Multiplexing, header compression, faster performance

Advantages

  • Simple and human-readable
  • Platform independent
  • Widely supported across all browsers and servers
Open this answer on its own page →

TCP vs UDP differences

2081 · 5 marks

Write down the major difference between TCP and UDP protocol. [5]

--- Feature TCP (Transmission Control Protocol) UDP (User Datagram Protocol) --------- Connection Type Connection-oriented (establishes connection via 3-way handshake before data transfer) Connectionless (sends data without establishing a connection) Reliability Reliable - guarantees delivery of ...

Open this answer on its own page →

FTP protocol and operation

2079 · 5 marks

What is FTP and how does it work? [5]

FTP (File Transfer Protocol) is a standard application layer protocol used for transferring files between a client and a server over a TCP/IP network. It is defined in RFC 959 and operates at the Application Layer of the TCP/IP model. --- - Uses TCP as the transport protocol (reliable, connection...

Open this answer on its own page →

SNMP protocol and operation

2080.2 · 5 marks

What is SNMP and how does it work? [5]

SNMP (Simple Network Management Protocol) is an application layer protocol used for managing and monitoring network devices (routers, switches, servers, printers, etc.) across an IP network. It is part of the TCP/IP protocol suite and operates over UDP (port 161 for queries, port 162 for traps). ...

Open this answer on its own page →

UDP user datagram format

0 · 5 marks

Describe user datagram format. List at least four ports used with UDP [5]

UDP provides a connectionless, unreliable transport service. Each UDP packet is called a user datagram. The format is simple and has a fixed 8-byte header followed by data. Field Size Description -------------------------- Source Port 16 bits Port number of the sending process (optional; set to 0...

Open this answer on its own page →