6 Application Layer

Computer Networks · Unit 6 · 7 hrs

Application Layer

Exam-focused notes for Application Layer (Computer Networks, CSC263): what the TU syllabus asks and how it has actually been tested, with 6 solved past questions from this unit.

Application Layer in short

This chapter covers the application layer: what it does, the web and HTTP, how domain names are resolved, the protocols used to move files and email, the server roles that support those applications, and the SNMP protocol used to manage a network's own devices.

Application Layer: notes

Introduction and Functions

The application layer is the highest layer of the TCP/IP model, providing the interfaces and protocols that user-facing programs need. Applications at this layer produce the data that has to travel across the network, and the layer serves as the window through which those applications reach the network and through which results are shown back to the user; browsers, messaging clients and similar programs live here. Its core functions are file transfer (letting a user access, retrieve and manage files on a remote computer), mail services (the basis for forwarding and storing email) and directory services (giving access to distributed information about network resources and services).

Web and HTTP

The World Wide Web (WWW) is a global network of servers linked by a common protocol, letting a client reach hypertext resources hosted on many different websites through a single browsing experience. Hyper Text Transfer Protocol (HTTP) is the application-layer protocol that transfers the pages a user browses; it runs over TCP rather than UDP because reliable, in-order delivery matters for web content.

An HTTP exchange is built from a request and a response. The request line has three parts: a method (most commonly GET), the requested resource's path, and the HTTP version, for example GET /path/to/index.html HTTP/1.1. The response's status line also has three parts: the HTTP version, a numeric status code, and a short reason phrase, for example HTTP/1.1 200 OK or HTTP/1.1 404 Not Found.

HTTP connections can be persistent or non-persistent. Since HTTP/1.1, connections are persistent by default: the server keeps the underlying TCP connection open after a response so further requests can reuse it, closing it only on a client request or a timeout; if the length of the returned data cannot be known in advance (a dynamically generated page, for instance), the server signals this and closes the connection once the data ends, so the client can tell where it stops. Versions before HTTP/1.1 used non-persistent connections: the client opens a new TCP connection for every single request, the server responds and closes it, and the client reads until an end-of-file marker before closing its side too. For a page built from $N$ separate embedded files, a non-persistent connection must be opened and closed $N$ times, forcing the server to maintain $N$ separate buffers and repeat a slow-start ramp-up for each one, which is why persistent connections became the default.

What this unit covers

  • Introduction and Functions
  • Web &HTTP
  • DNS and the Query Types
  • File Transfer and Email Protocols: FTP, SFTP, SMTP, IMAP, POP3
  • Overview of Application Server Concepts: Proxy, Web, Mail
  • Network Management: SNMP

DNS and the Query Types

2081 · 10 marks

What are the features of the application layer? Why is DNS required? Explain about recursive, non-recursive, and iterative DNS queries.[10]

Show solved answer

Application Layer: Features, DNS, and Query Types


1. Features of the Application Layer

The Application Layer is Layer 7 of the OSI model (also called the Desktop Layer). It is implemented by network applications that produce data to be transferred over the network. It serves as a window for application services to access the network and display received information to the user.

Key Features / Functions:

FeatureDescription
File TransferAllows users to access, retrieve, and manage files on a remote computer (e.g., FTP)
Mail ServicesProvides the basis for email forwarding and storage facilities (e.g., SMTP, POP3)
Directory ServicesProvides database source access for global information about various services
Network Virtual TerminalAllows a user to log on to a remote host and work as if connected locally
User InterfaceResponsible for node-to-node communication and controls user-interface specifications
Access to Network ResourcesEnables browsers, messengers, Skype, and other applications to communicate over the network
Protocol SupportSupports protocols such as HTTP, HTTPS, SSH, DNS, FTP, SMTP, etc.

2. Why is DNS Required?

DNS (Domain Name System) is a hierarchical, distributed naming system used on the Internet.

The Core Problem:

  • Computers communicate using IP addresses (e.g., 142.250.190.46)
  • Humans find it easy to remember domain names (e.g., www.google.com)
  • There is a need for a system that translates domain names into IP addresses automatically

Reasons DNS is Required:

  1. Human Readability: It is nearly impossible for users to memorize numeric IP addresses for every website. DNS maps easy-to-remember names to IP addresses.

  2. Scalability: The Internet has billions of devices. A single centralized host file (like the old HOSTS.TXT) cannot scale. DNS uses a distributed hierarchical database to handle this.

  3. Dynamic IP Management: IP addresses of servers can change. DNS allows the domain name to remain constant even if the underlying IP address changes.

  4. Load Distribution: DNS can map one domain name to multiple IP addresses, enabling load balancing across servers.

  5. Service Location: DNS supports different record types (MX, CNAME, etc.) to locate mail servers, aliases, and other services.

In short: DNS acts as the "phone book" of the Internet, making it usable and accessible for humans.


3. Types of DNS Queries

When a client needs to resolve a domain name, the DNS system uses three types of queries:


3.1 Recursive DNS Query

Client --> Local DNS Resolver --> Root DNS --> TLD DNS --> Authoritative DNS
         <--(final answer)------<-----------<-----------<------------------
  • In a recursive query, the client asks the DNS resolver to do all the work and return the final answer.
  • The DNS resolver (usually the ISP's DNS server) takes full responsibility for resolving the query.
  • It contacts other DNS servers on behalf of the client and returns the complete resolved IP address or an error.
  • The client only makes one request and waits for the complete answer.

Steps:

  1. Client sends query to Local DNS Resolver: "What is the IP of www.example.com?"
  2. Local Resolver queries Root DNS Server
  3. Root DNS refers to TLD (.com) DNS Server
  4. TLD DNS refers to Authoritative DNS Server
  5. Authoritative DNS returns the IP address
  6. Local Resolver returns the final IP back to the client

Advantage: Simple for the client
Disadvantage: Heavy load on the DNS resolver


3.2 Non-Recursive (Iterative) DNS Query

Note: In many textbooks, "non-recursive" and "iterative" are used interchangeably. They describe the same process where the resolver is directed step-by-step.

Client --> Local DNS Resolver
           |
           +--> Root DNS Server  --> "Ask TLD Server at X.X.X.X"
           |
           +--> TLD DNS Server   --> "Ask Authoritative Server at Y.Y.Y.Y"
           |
           +--> Authoritative DNS Server --> "IP is Z.Z.Z.Z"
           |
Client <-- Final Answer
  • In an iterative (non-recursive) query, the DNS server does not do the full resolution itself.
  • Instead, it returns the best answer it currently has -- which may be a referral (address of another DNS server that might know the answer).
  • The resolver itself is responsible for following up with each referred server.
  • The process continues until the authoritative answer is found.

Steps:

  1. Client asks Local Resolver: "What is the IP of www.example.com?"
  2. Local Resolver asks Root DNS: Root says "I don't know, but ask the TLD server at 192.5.6.30"
  3. Local Resolver asks TLD DNS: TLD says "I don't know, but ask the Authoritative server at 205.251.196.1"
  4. Local Resolver asks Authoritative DNS: Returns "IP = 93.184.216.34"
  5. Local Resolver returns the IP to the client

Advantage: Distributes the load across multiple DNS servers
Disadvantage: More round trips required


3.3 Summary Comparison Table

FeatureRecursive QueryIterative (Non-Recursive) Query
Who does the work?DNS Resolver does all the workResolver follows referrals step by step
Response to clientFinal IP address (complete answer)Referral or final answer at each step
Load on resolverHighDistributed
Number of client requestsOneOne (but resolver makes multiple)
Typical useClient to Local ResolverLocal Resolver to other DNS servers
Error handlingReturns error if not foundReturns "not found" at each step
Open this answer on its own page →

2076 · 5 marks

Why do we need a DNS system when we can directly use an IP address? what is domain name space? [5]

Show solved answer

DNS System and Domain Name Space

Why Do We Need DNS When We Can Directly Use IP Addresses?

Although it is technically possible to access any resource on the internet using its IP address directly (e.g., typing 192.168.1.1 in a browser), the DNS system is needed for the following important reasons:

1. Human Readability and Memory

  • IP addresses are numeric (e.g., 142.250.190.46) and are very difficult for humans to remember.
  • Domain names like www.google.com are meaningful, easy to remember, and user-friendly.
  • DNS acts as a translator between human-readable domain names and machine-readable IP addresses.

2. Flexibility and IP Change Management

  • The IP address of a server may change over time (due to server migration, ISP changes, etc.).
  • With DNS, the domain name stays the same while only the DNS record is updated in the background.
  • Users never need to know or update the new IP address.

3. Load Distribution

  • A single domain name can map to multiple IP addresses, allowing traffic to be distributed across several servers.
  • This would not be possible if users directly used a single IP address.

4. Supporting Other Programs

  • As stated in the notes, DNS is a supporting program used by other programs such as e-mail.
  • Many internet services (email, FTP, web browsing) rely on DNS to function correctly.

5. Scalability

  • The internet has billions of devices. Maintaining and distributing a manual list of IP-to-name mappings for every user would be impossible.
  • DNS provides a distributed, hierarchical, and scalable solution to this problem.

Domain Name Space

The Domain Name Space is the hierarchical and organized structure used by DNS to manage and store all domain names on the internet.

Key Characteristics:

  • The domain name space is organized as an inverted tree structure, with the root at the top.
  • The tree is divided into levels, and each node in the tree has a label.
  • The full domain name of any node is called its Fully Qualified Domain Name (FQDN), which is read from the node up to the root, separated by dots (.).

Structure of Domain Name Space:

            . (Root)
           / \
         com  org  net  edu  gov  (Top-Level Domains - TLD)
         /
      google
       /
     www
LevelExampleDescription
Root.Top of the hierarchy, managed by IANA
Top-Level Domain (TLD).com, .org, .eduFirst level below root
Second-Level Domaingoogle, exampleRegistered by organizations/individuals
Subdomainwww, mailFurther divisions within a domain

Example:

For the domain name www.google.com:

  • com is the Top-Level Domain (TLD)
  • google is the Second-Level Domain
  • www is the subdomain/host

Summary:

The domain name space is a global, hierarchical, tree-structured naming system that organizes all domain names on the internet, allowing DNS to efficiently translate human-readable names into IP addresses.

Open this answer on its own page →

2080.1 · 5 marks

What do you understand by DNS? Explain FTP and SFTP. [5]

--- DNS is a hierarchical, distributed naming system used on the Internet that translates human-readable domain names (e.g., www.google.com) into machine-readable IP addresses (e.g., 142.250.64.100). - Without DNS, users would have to remember numeric IP addresses for every website. - DNS works l...

Open this answer on its own page →

Overview of Application Server Concepts

2081 · 5 marks

Difference between web server and proxy server. [5]

Show solved answer

Difference Between Web Server and Proxy Server

Web Server

A web server is a server that stores, processes, and delivers web content (HTML pages, images, files) directly to clients (browsers) using the HTTP protocol. It responds to client requests by serving the requested resources from its own storage.

  • It is the origin/destination of the client's request.
  • It hosts websites and web applications.
  • It communicates directly with the end user's browser.
  • Example: Apache, Nginx, IIS.

Proxy Server

A proxy server is an intermediary server that separates end-user clients from the destinations they browse. It translates traffic between networks or protocols and evaluates outbound (or inbound) requests before relaying them to the actual destination.

  • It sits between the client and the web server.
  • It does not necessarily host any content of its own.
  • Example: Squid, Varnish.

Key Differences

BasisWeb ServerProxy Server
RoleHosts and serves web content directly to clientsActs as an intermediary between client and destination server
PositionIs the final destination of a client requestSits between the client and the web server
ContentStores and serves its own content (HTML, images, etc.)Does not store original content; forwards requests and responses
PurposeTo deliver web pages and resourcesTo provide security, privacy, caching, and access control
IP HidingDoes not hide the client's IP addressCan hide the client's IP address while browsing
CachingMay cache responses for performanceCommonly used for caching to save bandwidth and improve speed
SecurityProvides security for hosted contentProvides security by filtering and controlling internet usage
TypesStatic or Dynamic web serverForward proxy, Reverse proxy, Open proxy
ExampleApache, NginxSquid, Varnish, VPN

Summary

In short, a web server is the source of web content, while a proxy server is a middleman that controls, filters, or relays communication between the client and the web server. A proxy server is used for purposes such as:

  • Controlling internet usage of employees and children
  • Bandwidth savings and improved speeds
  • Privacy benefits (hiding IP address)
  • Improved security
  • Getting access to blocked resources
Open this answer on its own page →

File Transfer and Email Protocols

2080 · 5 marks

Differentiate between IMAP and POP3. Explain SNMP. [5]

--- Both IMAP and POP3 are email retrieval protocols used at the Application Layer to receive emails from a mail server. Feature IMAP (Internet Message Access Protocol) POP3 (Post Office Protocol v3) --------- Full Form Internet Message Access Protocol Post Office Protocol Version 3 Port Number P...

Open this answer on its own page →

Web &HTTP

2079 · 5 marks

Explain architecture of WWW. What is URL? [5]

The World Wide Web (WWW) is based on a Client/Server Architecture that operates over the Internet. It is a system of interlinked hypertext documents and resources accessed via the Internet using web browsers. - The client is the consumer side of the architecture - Web browsers (Chrome, Firefox, e...

Open this answer on its own page →