optional · CSS study notes
Servers, Server Types & Protocol Stack
🧭
On this page — click any heading below to jump straight to it. ⬅️ Back to P-II.II. Computer Communications & Networks
OSI Layer: Application Layer (L5–L7)
Definition
A server is a program (and, by extension, the physical/virtual machine running it) that provides a service to other programs (clients) on request, typically running continuously and listening on a well-known port number for incoming connections — the provider side of the client-server architecture covered on the Network Application Architectures page.
Types of Servers (Classification by Function)
1. Web Server
- Serves web pages and other content to browsers using HTTP (port 80) or HTTPS (port 443).
- Examples: Apache HTTP Server, Nginx, Microsoft IIS.
- Distinguished from an Application Server: a web server serves mostly static content and simple dynamic pages; an application server hosts the actual business logic/application code (e.g., Java EE, .NET) and is often placed behind a web server — a classic exam trap is treating the two as identical.
2. Mail Server
- Actually two cooperating roles, often on separate protocols:
- Outgoing/relay — SMTP (Simple Mail Transfer Protocol), port 25 (server-to-server relay) or 587 (client submission) — pushes mail from sender to recipient's mail server.
- Incoming/retrieval — POP3 (port 110) downloads mail to one device and typically deletes it from the server, vs IMAP (port 143), which keeps mail synchronised on the server so it stays consistent across multiple devices.
- This POP3-vs-IMAP distinction (download-and-delete vs synchronise) is a frequently tested comparison.
3. FTP Server
- Transfers files using FTP, which uniquely uses two separate connections: a control connection (port 21) that stays open for commands, and a data connection (port 20 in active mode, or a dynamically negotiated port in passive mode, used for the actual file transfer).
- Passive mode is preferred when the client is behind a firewall/NAT that would block an inbound active-mode data connection.
4. DNS Server
- Resolves domain names to IP addresses, using port 53. Classified by role in the resolution hierarchy:
- Root server — the top of the hierarchy, directs a query to the correct TLD server.
- TLD (Top-Level Domain) server — handles one suffix (.com, .pk, etc.), directs to the correct authoritative server.
- Authoritative server — holds the actual DNS records for a specific domain and gives the final answer.
- Recursive resolver — the server a client actually queries (often run by an ISP); it performs the full root → TLD → authoritative walk on the client's behalf and caches the result.
5. DHCP Server
- Dynamically assigns IP addresses (and related configuration: subnet mask, gateway, DNS servers) to hosts joining a network, using ports 67 (server) and 68 (client).
- Operates via the DORA process: Discover (client broadcasts for a server) → Offer (server offers an address) → Request (client requests that specific offer) → Acknowledge (server confirms the lease).
6. Proxy Server
- Forward proxy — sits in front of clients, forwarding their requests onward; hides the client's identity from the destination server and can enforce content filtering/caching for an organisation.
- Reverse proxy — sits in front of one or more servers, forwarding client requests to them; hides the server's identity/topology from clients and commonly performs load balancing, SSL termination, and caching.
7. File Server
- Shares files/storage over a network using protocols such as SMB/CIFS (port 445) (Windows-native file sharing) or NFS (Network File System) (common in Unix/Linux environments).
8. Database Server
- Hosts a DBMS and answers structured queries from client applications, typically over a vendor-specific TCP port (e.g., MySQL 3306, PostgreSQL 5432, MS SQL Server 1433), often accessed via a driver interface such as ODBC/JDBC.
9. Application Server
- Hosts and executes the core business-logic layer of an application (as opposed to just serving static pages), commonly sitting between a web server (front end) and a database server (back end) in a classic three-tier architecture.
10. Print Server
- Manages and queues print jobs from multiple clients to shared network printers.
11. Virtual / Cloud Server
- A virtualised compute instance (e.g., AWS EC2, Azure VM) that can be configured to run any of the above server roles without dedicated physical hardware — the modern deployment model for most of these services.
Well-Known Server Ports (Quick Reference)
| Server / Protocol | Port(s) | Transport |
|---|---|---|
| HTTP | 80 | TCP |
| HTTPS | 443 | TCP |
| FTP | 20 (data), 21 (control) | TCP |
| SSH | 22 | TCP |
| Telnet | 23 | TCP |
| SMTP | 25 / 587 | TCP |
| DNS | 53 | UDP (queries) / TCP (zone transfers, large responses) |
| DHCP | 67 (server), 68 (client) | UDP |
| POP3 | 110 | TCP |
| IMAP | 143 | TCP |
| SNMP | 161 | UDP |
| SMB/CIFS | 445 | TCP |
Protocols Working at Each OSI Layer (Full Classification)
Every server ultimately depends on a full protocol stack beneath its own application-layer protocol — this table is the complete cross-reference tying servers back to the OSI Model page:
| OSI Layer | Protocols | Relevance to Servers |
|---|---|---|
| Application (L7) | HTTP, HTTPS, FTP, SMTP, POP3, IMAP, DNS, DHCP, SNMP, Telnet, SSH, SIP | The actual server-provided service protocol |
| Presentation (L6) | SSL/TLS, JPEG, ASCII/EBCDIC | Encrypts/formats data before it reaches the application (e.g., HTTPS = HTTP + TLS) |
| Session (L5) | NetBIOS, RPC, PPTP | Manages the logical session between client and server |
| Transport (L4) | TCP, UDP, SCTP | Delivers data to the correct server process via its listening port |
| Network (L3) | IP, ICMP, IGMP, RIP, OSPF, BGP | Routes client requests to the server's host across networks |
| Data Link (L2) | Ethernet, PPP, HDLC, ARP | Delivers frames on the local link to/from the server's NIC |
| Physical (L1) | Cabling/signal standards (e.g., 802.3 physical specs, DSL, fibre standards) | Carries the raw bits to and from the server hardware |
Process Walkthroughs
DHCP DORA (getting an IP address)
- Discover — client broadcasts a DHCPDISCOVER (no IP yet, so it broadcasts to 255.255.255.255).
- Offer — an available DHCP server responds with DHCPOFFER, proposing an address and lease.
- Request — client broadcasts DHCPREQUEST, explicitly accepting one specific offer (also tells any other offering servers their offer wasn't taken).
- Acknowledge — the chosen server responds with DHCPACK, finalising the lease.
Recursive DNS Resolution (looking up a domain)
- Client asks its configured recursive resolver for
www.example.com. - Resolver asks a root server, which replies with the address of the
.comTLD server. - Resolver asks the TLD server, which replies with the address of
example.com's authoritative server. - Resolver asks the authoritative server, which returns the actual IP address.
- Resolver caches and returns the answer to the client — subsequent lookups are answered instantly from cache until the record's TTL expires.
CSS Exam Angle
- A very common short-question format is "differentiate a web server from an application server" or "differentiate POP3 from IMAP" — both are one-paragraph, high-value answers if memorised precisely.
- The DORA and recursive DNS resolution sequences are favourite "explain the steps" questions — draw them as a simple numbered client/server message sequence.
- Classifying DNS servers into root/TLD/authoritative/recursive shows depth beyond "DNS resolves names to IPs."
- Tie this page back to Network Application Architectures (client-server model) and OSI Model (which layer each protocol belongs to) for a well-integrated answer if a question spans multiple topics.
Example / Pakistan Context
A typical Pakistani ISP runs recursive DNS resolvers for its subscribers, a DHCP server to assign home-router IP addresses dynamically, and increasingly hosts reverse proxy/CDN cache servers (see Content Distribution Networks) inside its own network to reduce dependence on expensive international bandwidth — three different server types cooperating invisibly every time a user opens a website.
Likely Questions
- Differentiate a web server, an application server, and a database server.
- Explain the DORA process by which a DHCP server assigns an IP address to a client.
- Differentiate POP3 and IMAP as mail-retrieval protocols.
- Classify DNS servers by their role in the resolution hierarchy and explain recursive resolution step by step.
- Differentiate a forward proxy from a reverse proxy.
- Map each major server protocol (HTTP, FTP, SMTP, DNS, DHCP) to its OSI layer and port number.
📜 Past-Paper Questions & Structured Answers
Questions are paraphrased; answer focus is suggested guidance, not an official marking scheme.
2020 · Paper-I · Q3(a) · 4 marks
Question (paraphrased): Identify conventional ports for five named Internet services.
Answer focus: Write the requested service/port table directly.
| Service | Standard port |
|---|---|
| HTTP | 80 |
| FTP | 21 control; 20 for active-mode server data |
| SMTP | 25 for mail transfer between servers |
| HTTPS | 443 |
| DNS | 53 |
DNS uses both UDP and TCP. FTP passive data uses a negotiated port. HTTP/3 uses QUIC/UDP at 443; classical HTTPS uses TCP. These qualifications prevent the memorised table from becoming an absolute rule.
Related question: 2018 Paper-I Q2(a), 4 marks, asks for TCP/IP layers. The complete layer/function answer is in OSI Model. Server types themselves were not found as a separate descriptive question in the reviewed set.