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.
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 answerHide 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:
- Connection-Oriented: Establishes a connection via a 3-way handshake (SYN, SYN-ACK, ACK) before data transfer.
- Acknowledgement (ACK): Receiver acknowledges received segments; unacknowledged segments are retransmitted after timeout.
- Error Detection (Checksum): Corrupted segments are detected and discarded, then retransmitted.
- Sequencing: Sequence numbers allow reordering of out-of-order segments and detection of lost data.
- Flow Control: A sliding window prevents overwhelming the receiver.
- 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:
| Subnet | Subnet ID | Subnet Mask | First Host | Last Host | Broadcast |
|---|---|---|---|---|---|
| 1 | 192.168.1.0 | 255.255.255.224 | 192.168.1.1 | 192.168.1.30 | 192.168.1.31 |
| 2 | 192.168.1.32 | 255.255.255.224 | 192.168.1.33 | 192.168.1.62 | 192.168.1.63 |
| 3 | 192.168.1.64 | 255.255.255.224 | 192.168.1.65 | 192.168.1.94 | 192.168.1.95 |
| 4 | 192.168.1.96 | 255.255.255.224 | 192.168.1.97 | 192.168.1.126 | 192.168.1.127 |
| 5 | 192.168.1.128 | 255.255.255.224 | 192.168.1.129 | 192.168.1.158 | 192.168.1.159 |
| 6 | 192.168.1.160 | 255.255.255.224 | 192.168.1.161 | 192.168.1.190 | 192.168.1.191 |
| 7 | 192.168.1.192 | 255.255.255.224 | 192.168.1.193 | 192.168.1.222 | 192.168.1.223 |
| 8 | 192.168.1.224 | 255.255.255.224 | 192.168.1.225 | 192.168.1.254 | 192.168.1.255 |
Summary:
| Parameter | Value |
|---|---|
| Original Network | 192.168.1.0/24 |
| Subnets | 8 |
| Bits Borrowed | 3 |
| New Prefix | /27 |
| Subnet Mask | 255.255.255.224 |
| Block Size | 32 addresses |
| Usable Hosts | 30 per subnet |
Sliding Window Protocol
2082 · 5 marks
Write Short notes on: Sliding Window Protocol HTTP Protocol [0+2.5+2.5]
Show solved answerHide 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
| Type | Description |
|---|---|
| Go-Back-N | On error, retransmit the erroneous frame and all subsequent frames |
| Selective Repeat | Only 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
| Method | Purpose |
|---|---|
| GET | Retrieve a resource |
| POST | Submit data to the server |
| PUT | Update a resource |
| DELETE | Delete a resource |
| HEAD | Retrieve 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
| Code | Meaning |
|---|---|
| 200 | OK (Success) |
| 301 | Moved Permanently |
| 404 | Not Found |
| 500 | Internal 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
TCP vs UDP differences
2081 · 5 marks
Write down the major difference between TCP and UDP protocol. [5]
FTP protocol and operation
SNMP protocol and operation
UDP user datagram format
0 · 5 marks
Describe user datagram format. List at least four ports used with UDP [5]
Make Unit 8 stick
Practice BIT254 with flashcards & quizzes