Module I Computer Networks Notes
Module I Computer Networks Notes
In simple terms, a computer network can also be defined as the interconnection of devices that are
capable of exchanging information. This exchange may take the form of a text message between two
people, a file transferred from one server to another, or a video stream delivered from a content
provider to a user's smartphone. Regardless of the type of information exchanged, the underlying
requirement remains the same: a reliable communication path between the sending and receiving
devices.
Additional points to note: (a) A network can be as small as two computers connected by a single
cable, or as large as the Internet, which links billions of devices worldwide. (b) Networks are built
using a combination of hardware components (cables, routers, switches, network interface cards) and
software components (protocols, operating system network services, and applications). (c) The
performance of a network is generally judged using criteria such as performance (delay and
throughput), reliability (failure rate and recovery time), and security (protection from unauthorized
access).
The connections between these devices can be established using two broad categories of transmission
media. Wired media use physical cables, such as Ethernet cables (twisted-pair) or fiber-optic cables,
to carry signals from one device to another; these media generally provide high speed and are less
susceptible to interference. Wireless media, on the other hand, use radio waves or infrared signals —
technologies such as Wi-Fi, Bluetooth, and cellular communication — to connect devices without a
physical cable, offering mobility and ease of installation at the cost of being more vulnerable to
interference and eavesdropping.
● Extra point: Hybrid networks are common in practice — a home network, for example,
typically uses wired Ethernet for a desktop PC and a smart TV, while laptops and phones
connect wirelessly to the same router.
● Extra point: The choice of medium is influenced by factors such as cost, distance, required
speed, and the physical environment (e.g., fiber is preferred for long-distance backbone links,
while Wi-Fi is preferred for short-range, mobile connectivity).
1. Resource Sharing
One of the most fundamental reasons for building a network is to allow multiple users to share
hardware and software resources efficiently, instead of each user requiring a dedicated copy of every
resource. For example, a single expensive printer can be shared by an entire office instead of every
desk needing its own printer; files and folders stored on one machine can be accessed by authorized
users elsewhere on the network; a single high-speed Internet connection can be shared among many
devices in a home or office; and licensed software applications installed on a server can be accessed
by many client machines simultaneously. This sharing reduces overall cost and avoids duplication of
resources.
2. Communication
Networks enable fast and effective communication among users located in different places, ranging
from the same building to different continents. Common examples of network-enabled
communication
include electronic mail (e-mail) for asynchronous messaging, video conferencing for real-time face-
to-face meetings over long distances, instant messaging for quick text-based conversations, and voice
and video calls that replace or supplement traditional telephone conversations. This communication
capability has transformed the way businesses, educational institutions, and individuals interact.
3. Data Sharing
Beyond simple communication, networks facilitate the easy access, storage, and exchange of large
volumes of information. Centralized databases allow multiple applications and users to query and
update consistent data; cloud storage services let users store files remotely and retrieve them from
any connected device; multimedia content such as images, audio, and video can be streamed or
downloaded across the network; and shared documents allow multiple people to collaborate on the
same file, often simultaneously.
● Extra point: Networks also support scalability — an organization can add new users, devices,
or services without redesigning the entire computing infrastructure from scratch.
● Extra point: Networking underpins modern paradigms such as cloud computing, the Internet
of Things (IoT), and remote work, all of which depend on always-on connectivity between
distributed devices.
Real-life example: A family uses a Wi-Fi router at home to connect a laptop, a smartphone, a smart
TV, and a printer. All of these devices can access the Internet simultaneously and can also share
resources — for instance, streaming a movie from the laptop to the smart TV, or printing a document
from the smartphone — through the same home network.
2. Connecting Devices
Connecting devices are responsible for linking end devices and networks together and for directing
data toward its correct destination. A router connects different networks to one another and provides
access to external networks such as the Internet. A switch connects multiple devices within a single
Local Area Network (LAN) and transfers data efficiently between them by forwarding frames only
to the intended recipient port. A modem connects a network to an Internet Service Provider (ISP) and
converts digital signals generated by computers into analog signals suitable for transmission over
telephone or cable lines, and vice versa. An access point (AP) provides wireless connectivity to
devices and extends the coverage area of a Wi-Fi network.
Figure: Examples of networking hardware — devices such as routers and switches that interconnect end devices and
networks.
3. Transmission Media
Transmission media refer to the communication channel through which data physically travels from
one device to another. Transmission media are broadly classified into wired and wireless categories.
A. Wired Media
Twisted pair cable is the most commonly used network cable and is widely used in Ethernet
networks because it is inexpensive and easy to install. Coaxial cable is used in cable television
networks and for broadband Internet access, offering better shielding against interference than
twisted pair. Fiber optic cable uses light signals for transmission and offers very high speed and long-
distance communication capability, making it the medium of choice for backbone and long-haul
links.
B. Wireless Media
Radio waves are used for wireless communication over varying distances and form the basis for
many wireless technologies. Wi-Fi enables wireless networking in homes, offices, and public places
by using radio-frequency signals within a limited range. Satellite communication is used for long-
distance communication and for providing connectivity to remote areas that lack terrestrial
infrastructure.
● Extra point: The theoretical maximum data rate of a transmission medium is influenced by its
bandwidth and the signal-to-noise ratio, as described by the Shannon capacity formula.
● Extra point: Attenuation (signal weakening over distance) and electromagnetic interference
(EMI) affect wired media, while multipath fading and interference from other wireless
devices affect wireless media.
1.4 Types of Computer Networks
Computer networks are classified according to their geographical coverage, ranging from a network
spanning just a few meters to one that spans the entire globe. Understanding this classification helps
in selecting the appropriate networking technology for a given scale of deployment.
TYPES OF NETWORK
Network Type Full Form Area of Coverage Example
PAN Personal Area Network A few meters (around 1– Bluetooth connection
10 m) between a phone and
earbuds
LAN Local Area Network A room, building, or Network within a school,
campus (up to a few km) office, or home
CAN Campus Area Network Multiple buildings University campus
within a campus (1–10 network
km)
MAN Metropolitan Area A city or metropolitan City-wide cable TV or
Network area (10–100 km) internet network
WAN Wide Area Network Countries or continents Bank networks
(100 km and above) connecting branches
worldwide
GAN Global Area Network Worldwide coverage The Internet
A Personal Area Network (PAN) is the smallest type of network, typically connecting personal
devices within a range of a few meters, such as a smartphone paired with wireless earbuds via
Bluetooth. A Local Area Network (LAN) covers a room, a building, or a campus, and is the type of
network most commonly encountered in homes, schools, and offices. A Campus Area Network
(CAN) extends this concept to multiple buildings within the same campus, such as different
departments of a university connected together. A Metropolitan Area Network (MAN) spans a city or
metropolitan area, often used for city-wide cable television or Internet distribution. A Wide Area
Network (WAN) covers countries or continents and is typically used by organizations such as banks
to connect branches located far apart. Finally, a Global Area Network (GAN) provides worldwide
coverage, with the Internet itself being the most prominent example of a GAN.
● Extra point: As the geographical coverage of a network increases, the technologies used also
tend to change — LANs commonly use Ethernet or Wi-Fi, whereas WANs rely on leased
lines, MPLS, or satellite links.
● Extra point: The boundary between these categories is not always rigid in practice; for
example, a large enterprise LAN can sometimes be as large as a small MAN.
Intranet
An intranet is a private network that can only be accessed by authorized users. The prefix "intra"
means "internal," and therefore an intranet is, by definition, designed for internal communications
within an organization. An intranet is used within an organization to securely share information,
resources, and communication among its employees. It uses the same underlying technologies as the
public Internet (such as HTTP and TCP/IP) but is accessible only to authorized users within the
organization, typically protected by firewalls and authentication systems.
Common examples of intranets include an employee portal used for HR-related tasks, an internal
company website containing policies and announcements, and a school management system used by
staff and students to manage academic records.
Components of an Internetwork
An internetwork is typically composed of LANs, which provide communication within a local area;
WANs, which connect distant networks across large geographical areas; routers, which connect
different networks together and route packets between them based on logical (IP) addresses; and
switches, which forward packets within a single LAN based on physical (MAC) addresses.
● Extra point: Routers operate at the Network layer (Layer 3) of the OSI model, while switches
typically operate at the Data Link layer (Layer 2).
● Extra point: Modern "Layer 3 switches" blur this distinction by performing basic routing
functions in hardware at very high speed.
A Switched WAN, by contrast, connects multiple devices or networks through intermediate switches,
allowing communication to take place over a much larger area involving many endpoints rather than
just two. The Internet itself, along with large telecommunications networks, is a prime example of a
switched WAN.
Figure: A Point-to-Point WAN directly linking two networks/devices through a dedicated line.
Figure: A Switched WAN connecting multiple networks/devices through intermediate switches.
For example, a company's internal network connecting all of its offices constitutes a private internet,
whereas the worldwide network used for websites, e-mail, and other online services is simply "the
Internet."
Consider a typical example: four telephones on each side of a network are connected through
switches, and the two switches are connected by a single high-capacity line. This high-capacity line
can support four simultaneous voice calls, and the switches simply forward the voice signals without
storing any data.
In the case of full utilization, all four telephones on one side are connected to four telephones on the
other side, so the high-capacity line carries four voice calls simultaneously, meaning the entire
capacity of the line is used — this represents the most efficient situation for a circuit-switched
network. In the case of partial utilization, only one telephone might be in use at a given time,
meaning only one out of
the four available channels is actually carrying traffic while the remaining three channels stay unused
even though they remain reserved and available; in this scenario, only twenty-five percent of the
line's capacity is being utilized. This example illustrates why circuit switching can become inefficient
during periods of low traffic, since reserved capacity that is not being used cannot be given to other
users.
Figure: Circuit-switched network — telephones connected through switches over a dedicated high-capacity line.
Figure: Circuit switching — illustration of full utilization versus partial utilization of the reserved line capacity.
Packet-Switched Network
In a packet-switched network, data is not sent as one continuous, uninterrupted stream. Instead, the
data is divided into small units called packets. Each packet contains a portion of the overall data,
travels independently through the network (potentially via different routes), and can be stored
temporarily and forwarded later if the network is congested. In this architecture, computers act as end
devices, while routers act as the switching elements; routers have memory in the form of queues that
allow them to store packets temporarily when necessary.
In a low-traffic scenario, when a single computer at Site A communicates with a single computer at
Site B, the communication line has more than enough capacity, so packets are forwarded
immediately with no waiting or delay. In a heavy-traffic scenario, when many computers send
packets at the same time, the communication line may reach its maximum capacity; new packets
arriving at a router cannot be sent immediately, so they are placed in a queue (buffer) and forwarded
one by one in the order in which they arrived.
For example, suppose the main communication line can carry only two packets at a time, but four
computers start sending packets simultaneously. In this case, the first two packets are transmitted
immediately, while the remaining packets wait in the router's queue; as space becomes available on
the line, the queued packets are forwarded in turn. Packet switching is generally more efficient than
circuit switching because no dedicated path is permanently reserved, bandwidth is shared
dynamically among all users, network resources are used only when data is actually being
transmitted, and any unused capacity can immediately be utilized by other users rather than sitting
idle.
Figure: Packet-switched network — computers as end devices and routers acting as switches with queues for temporary
storage of packets.
Figure: Packet switching under heavy traffic — packets queued at a router when the line reaches maximum capacity.
● Extra point: Circuit switching guarantees a fixed bandwidth and consistent delay for the
duration of a call, which is why it was traditionally preferred for voice telephony.
● Extra point: Packet switching is the foundation of the modern Internet (via IP), because it
allows efficient, statistical sharing of network links among many simultaneous users and
applications.
● Extra point: A third approach, message switching (store-and-forward of entire messages),
historically preceded packet switching but is rarely used today due to high delay and storage
requirements.
The Internet is organized hierarchically into three levels: Backbone Networks, Provider Networks,
and Customer Networks. Backbone networks are the largest and fastest networks, owned by major
telecommunications companies such as AT&T, Verizon, Sprint, and NTT; they form the very core of
the Internet and are interconnected with one another through peering points. Provider networks are
smaller networks that connect to the backbone networks, pay fees to use backbone services, and in
turn provide Internet access to their own customers; these are also called National or Regional ISPs.
Customer networks are the networks used by homes, schools, colleges, offices, and businesses; they
sit at the edge of the Internet and pay provider networks for their Internet service.
Figure: The three-level hierarchical structure of the Internet — backbone, provider, and customer networks.
Using telephone networks, a dial-up service uses a modem to convert digital data into analog voice-
band signals and connects to the ISP through an ordinary telephone line; this method is very slow,
and the telephone line cannot be used for voice calls and Internet access at the same time. Digital
Subscriber Line (DSL) technology, in contrast, uses the same existing telephone lines but provides
much higher Internet speed, and it allows telephone and Internet services to be used simultaneously
because it uses a different frequency band from voice calls.
Using cable networks, Internet access is provided over the same cable TV infrastructure used for
television broadcasts, offering higher speeds than dial-up and DSL, although the actual speed
experienced by a user may vary depending on how many other users are sharing the same cable
segment. Using wireless networks, users connect to the Internet using wireless technologies, a
method well suited to homes and small businesses and increasingly popular due to the mobility and
convenience it offers. Finally, large organizations, universities, and corporations often use a direct
connection to the Internet, in which they lease a high-speed WAN connection and connect directly to
a regional ISP; such organizations can, in turn, act as a local ISP for their own internal networks and
departments.
Formally, the TCP/IP Protocol Suite can be defined as a hierarchical collection of communication
protocols organized into layers that together facilitate reliable and efficient communication between
interconnected devices over the Internet.
Why TCP/IP Uses Layering
Network communication is a complex process that involves data transmission, routing, error
checking, and the provision of application-level services all at once. To manage this complexity,
TCP/IP adopts a layered architecture in which the overall task of communication is divided into a set
of smaller, more manageable sub-tasks, each handled by a distinct layer.
The advantages of this layered approach are numerous: each layer performs a specific and well-
defined function; layers operate largely independently of one another, so changes inside one layer do
not require changes in the others as long as the interface between layers remains the same; network
design, implementation, and troubleshooting become considerably easier because problems can be
isolated to a specific layer; and standardization at each layer enables interoperability among devices
and technologies built by different manufacturers.
Each layer provides services to the layer directly above it and, in turn, receives services from the
layer directly below it. This structured, layer-by-layer approach ensures efficient, reliable, and well-
organized communication across the network. In simple terms, the TCP/IP model divides a complex
communication process into smaller, manageable layers, making Internet communication both
efficient and reliable.
The reason TCP/IP does not have separate Session and Presentation layers is that some functions
traditionally assigned to the OSI Session layer are instead handled by Transport layer protocols in
TCP/IP; application programs are free to implement any needed Presentation or Session-layer
functionality themselves if required; and combining these layers into a single Application layer
simplifies the overall TCP/IP architecture without any real loss of functionality in practice.
Figure: Mapping between the seven-layer OSI model and the five-layer TCP/IP model.
At the Application layer, the sender creates a message, and logically the Application layer at the
sender communicates with the Application layer at the destination host; the object exchanged at this
layer is simply called a Message. At the Transport layer, the message is divided into segments (if
TCP is used) or user datagrams (if UDP is used), and logical communication occurs between the
Transport layers of the source and destination hosts; the object exchanged here is called a Segment or
User Datagram. At the Network layer, the Transport layer passes its data down to the Network layer,
which adds an IP header, creating a Datagram (also called a Packet); intermediate routers process
data only up to this layer, and the datagram remains logically the same as it travels across the
Internet.
At the Data Link layer, the Network layer passes the datagram down to the Data Link layer, which
encapsulates it into a Frame; unlike datagrams, frames are exchanged only between directly
connected devices, and a new frame may be created at every hop along the path. Finally, at the
Physical layer, frames are converted into a stream of Bits, which are then transmitted as electrical,
optical, or wireless signals through the transmission medium.
Figure: Logical (peer-to-peer) communication between corresponding layers of the sender and receiver in the TCP/IP
model.
Figure: The objects exchanged at each layer — Message, Segment/Datagram, Packet, Frame, and Bits.
Figure: Data flow through the TCP/IP layers from the Application layer down to the Physical layer.
Figure: Router processing shown only up to the Network layer, illustrating why the datagram remains unchanged end-
to-end.
Figure: Frame creation at each hop between directly connected devices in the Data Link layer.
Figure: Conversion of frames into a stream of bits for transmission at the Physical layer.
This overall encapsulation flow can be summarized as: Message → Segment/User Datagram →
Datagram → Frame → Bits. Decapsulation is simply the reverse process that occurs at the receiving
host: as the bits travel up through the layers, each layer strips off the header added by its counterpart
layer at the sender, ultimately recovering the original message at the Application layer.
Figure: Encapsulation and decapsulation of data as it moves down and up the TCP/IP protocol stack.
Figure: Headers added at each layer during encapsulation — Transport, Network, and Data Link headers.
Figure: Encapsulation flow — Message to Segment/Datagram to Frame to Bits.
Figure: Decapsulation at the receiving host, where each layer removes the corresponding header.
Figure: Overall encapsulation/decapsulation process shown end-to-end between sender and receiver.
For example, at the Transport layer, TCP can receive data originating from application-layer
protocols such as HTTP, FTP, SMTP, or DNS, while UDP can receive data from protocols such as
DNS, DHCP, or VoIP applications. At the Network layer, IP can receive TCP segments, UDP user
datagrams, ICMP packets, or IGMP packets, all of which it multiplexes into IP datagrams. At the
Data Link layer, a single frame can carry IP datagrams, ARP packets, or other network-layer
protocol data.
Demultiplexing occurs at the destination (receiver) side and is the reverse of multiplexing. A
protocol at the receiver examines the header information of the received packet, and based on the
protocol identifier found there, delivers the packet to the correct higher-layer protocol before
decapsulating it and passing it further upward. For example, at the Data Link layer, the receiver
delivers the payload to either IP or ARP based on the frame's type field; at the Network layer,
packets are delivered to TCP, UDP, ICMP, or IGMP based on the protocol field in the IP header; and
at the Transport layer, data is delivered to the correct application, such as HTTP, FTP, SMTP, or
DNS, using port numbers.
Figure: Multiplexing at the Transport and Network layers — multiple protocols feeding into a single lower-layer
protocol.
Figure: Demultiplexing at the receiver — a packet delivered to the correct higher-layer protocol using a protocol/port
identifier.
This is called logical communication because the connection between the two Application layers is
imaginary — actual data transfer physically occurs through the Transport, Network, Data Link, and
Physical layers. For example, when a user opens a website, the web browser sends an HTTP request,
which travels through all of the TCP/IP layers before the destination web server receives it; the
server
then sends an HTTP response back to the browser along the same layered path. To the two
applications involved, it appears as though they are communicating directly with one another.
Application-Layer Paradigms
Internet communication fundamentally requires two application programs, running on two different
computers, to exchange messages with each other through the Internet. The relationship between
these two communicating programs is defined by what is called an Application-Layer Paradigm.
Depending on the paradigm, an application program may request a service, provide a service, or
perform both functions simultaneously. Two major paradigms have evolved for application-layer
communication: the Client-Server paradigm and the Peer-to-Peer (P2P) paradigm.
Client–Server Paradigm
The Client–Server paradigm is a communication model in which a server process provides services
and a client process requests those services through the Internet. In this model, the server is the
service provider, while the client requests services from the server. The server runs continuously and
waits for client requests, whereas the client starts only when a service is actually needed. Many
clients can connect to a single server at the same time, but the roles of client and server are
fundamentally different and cannot be interchanged; separate client and server programs are typically
required for each distinct service offered.
The working of the Client–Server model can be summarized as follows: the client initiates a
connection to the server; the client sends a service request; the server processes the request; the
server sends a response back to the client; and the client receives the requested service.
A real-life analogy is a telephone directory service, in which the directory center acts as the server
and the subscriber acts as the client — the directory center is always available, while the subscriber
contacts it only when specific information is needed.
Figure: Client-Server communication model — clients requesting services from a continuously running server.
The advantages of the Client-Server paradigm include centralized control and management, easy
maintenance and updates, efficient resource sharing, and better security and data management, since
all critical data and logic reside on a controlled server. The disadvantages include a heavy workload
placed on the server, the requirement for powerful and often expensive server hardware, the fact that
server failure affects all connected clients simultaneously, high setup and maintenance costs, and the
possibility of degraded performance when a very large number of clients connect at the same time.
Common examples of client-server applications include the World Wide Web (WWW) using HTTP,
the File Transfer Protocol (FTP), Secure Shell (SSH), and e-mail services.
Figure: Peer-to-Peer (P2P) communication model — every peer can act as both client and server.
The advantages of the P2P paradigm include the elimination of expensive dedicated servers, making
it cost-effective; easy scalability as new peers join; distribution of workload among peers; and better
overall utilization of network resources. The disadvantages include the fact that security becomes
more challenging to enforce in a fully decentralized system, distributed services are more difficult to
manage, data availability depends on which peers happen to be online at a given time, and the model
is not suitable for every type of Internet application. Common applications of the P2P paradigm
include Internet telephony, file sharing, BitTorrent, IPTV, and voice and video communication. In
Internet telephony, for instance, both users communicate directly with each other, and no dedicated
server is required to continuously provide the calling service; similarly, in file sharing, users
exchange files directly, and no permanent server needs to be maintained by any single user.
Figure: Examples of P2P applications — file sharing and Internet telephony between peers.
Mixed Paradigm
The Mixed paradigm combines features of both the Client-Server and Peer-to-Peer paradigms in
order to take advantage of the strengths of each model. In this approach, a central server is used only
for specific, limited tasks such as locating peers, while the actual service or data transfer occurs
directly between the peers themselves. This design reduces the load placed on the server while still
improving scalability and efficiency compared to a pure client-server system.
The working of the Mixed paradigm proceeds as follows: a client first contacts a server to find the
network address of a suitable peer; the server provides this peer's address to the client; the client then
establishes a direct connection with that peer; data or services are exchanged directly between the
two peers; and the server is no longer involved once the actual communication begins. The
advantages of this approach include reduced server workload, greater scalability than a pure client-
server architecture, cost-effectiveness, efficient resource sharing, and the ability to combine
centralized control with distributed communication. Applications of the Mixed paradigm include
peer-to-peer file sharing, Internet telephony services such as Skype, BitTorrent, and IPTV.
A Socket Address is used to uniquely identify a process running on a particular computer. It consists
of two components: a 32-bit IP Address, which identifies the specific computer on the network, and a
16-bit Port Number, which identifies the specific application process running on that computer. This
relationship is often summarized with the formula: Socket Address = IP Address + Port Number.
Figure: A socket as the communication endpoint between a client process and a server process.
On the server side, the local socket address has an IP address known to the operating system and a
port number that is fixed and assigned to the server (for example, HTTP conventionally uses port
80), while the remote socket address is obtained from the client's request and changes with every new
client connection. On the client side, the local socket address has an IP address assigned by the
operating system and a temporary (ephemeral) port number assigned for that particular
communication session, while the remote socket address consists of the server's IP address and port
number, which can be obtained directly or resolved through DNS.
UDP (User Datagram Protocol) is a connectionless, unreliable, message-oriented protocol that is fast
and simple, and it provides no flow control or congestion control of its own. Its advantages include
low overhead and faster transmission, making it suitable for small messages; typical applications
include multimedia streaming, network management, and VoIP applications. A useful analogy for
UDP is sending letters through the post office, where each message (letter) is treated independently
of the others.
The popularity of the Web can be attributed to two especially important characteristics. Its
distributed nature means that web pages are stored on many different servers worldwide, allowing
the Web to grow without any practical limit. Its linked structure means that web pages can be
connected to one another through hyperlinks, enabling easy navigation between related documents.
The concept of linking documents together originated from the idea of Hypertext, which allows a
user to move from one document to another simply by clicking a link. Today, the term Hypermedia
is more commonly used, since modern web pages can contain not just text but also images, audio,
video, and animations.
A web page is a file identified by a unique name and address, known as a URL. Web pages can be
classified as either simple web pages, which contain only information and no links to other pages, or
composite web pages, which contain one or more hyperlinks to other web pages within the same site
or on different sites. Hyperlinks connect web pages together and allow users to navigate freely from
one page to another.
The overall working of the WWW architecture proceeds as follows: the user enters a URL into a web
browser; the browser (acting as the client) sends a request to the appropriate web server; the server
locates the requested web page; the server sends the page back to the browser; and the browser then
displays the page to the user, including any hyperlinks that lead to other pages.
To view the complete document with all of its referenced material, three separate transactions are
typically needed. The first transaction retrieves the main document, File A, which itself contains
references (links) to File B and File C. The second transaction is triggered only when the user
actually
clicks the image reference, at which point File B (the image) is retrieved. The third transaction is
triggered only when the user clicks the text-file reference, retrieving File C. Importantly, File A, File
B, and File C are independent web pages or files, each with its own name and address (URL); even
though File B and File C are referenced from within File A, they can be accessed independently, and
retrieving one file does not automatically retrieve the others.
The overall working of a browser proceeds as follows: the user enters a URL or clicks on a link; the
Controller sends a request using the appropriate client protocol; the requested document is retrieved
from the server; an Interpreter processes the retrieved document; and the resulting document is
displayed on the screen. Well-known examples of browsers include Internet Explorer, Netscape
Navigator, Firefox, and Google Chrome.
Figure: Internal architecture of a web browser — Controller, Client Protocols, and Interpreters.
Web Server
A web server is responsible for storing web pages and delivering them to clients whenever they are
requested. Its main functions are to store web pages and other files, to receive requests from
browsers, and to send the requested documents back to the requesting clients. Examples of widely
used web servers include the Apache Server and Microsoft Internet Information Server (IIS).
To summarize this section: a web document may contain references to other files, which require
separate transactions to retrieve; all referenced files are independent and have unique addresses; a
web browser consists of a controller, client protocols, and interpreters that together retrieve and
display web pages; and a web server stores web pages, responds to client requests, employs caching
for faster access, and uses multithreading or multiprocessing to serve multiple users efficiently at the
same time.
Figure: Interaction between a web client (browser) and a web server for retrieving a web page.
The Protocol specifies the client-server application used to access the resource and indicates how
data is transferred between the browser and the server; examples include HTTP, HTTPS, and FTP
(for instance, "[Link] The Host identifies the server on which the resource is stored and can be
given either as an IP address (such as [Link]) or as a domain name (such as [Link]). The
Port is a 16-bit integer that identifies a specific service on the server; it is usually predefined for
common protocols — for example, HTTP uses port 80 and HTTPS uses port 443 — and if the
default port for a protocol is being used, it is usually omitted from the URL that is displayed to the
user.
The Path specifies the exact location and name of the file on the server, consisting of one or more
directories followed by the file name; for example, in the UNIX-style path "/top/next/last/myfile,"
"top" is the top-level directory, "next" and "last" are subdirectories, and "myfile" is the actual file
name. Without a port number (the most common case), the URL format is protocol://host/path, as in
"[Link] with an explicit port number, the format becomes
protocol://host:port/path, as in "[Link] In summary, a URL
uniquely identifies a resource on the Internet and consists of a protocol (which specifies how the
resource is accessed), a host (which identifies the server), a port (which identifies the service on that
server), and a path (which identifies the exact file or resource).
Web Documents
Web documents can be classified into three main types. Static documents have fixed content that is
stored on a web server; users can only view a copy of the document, and its content remains the same
unless it is explicitly updated by a server administrator. Static documents are typically created using
languages such as HTML, XML, XSL, and XHTML; a college website's general information page is
a good example. Dynamic documents are created by the server at the moment they are requested by a
browser, so their content may change for each individual request; they are generated using programs
or scripts such as JSP, ASP, or ColdFusion, and a common example is a webpage that displays the
current date and time. Active documents contain programs or scripts that run on the client (browser)
side rather than on the server, and they are used for animations, interactive forms, and other forms of
user interaction; they are typically created using Java Applets or JavaScript, with interactive games
or animated graphics on a webpage serving as good examples.
In a persistent connection, which is the default behavior in HTTP/1.1, a single TCP connection is
used for multiple requests and responses instead of opening a new connection for every object. The
advantages of persistent connections include reduced overhead, faster page loading, less overall
network traffic, and better server performance, since the cost of setting up and tearing down a
connection is incurred only once rather than repeatedly.
Consider a specific nonpersistent-connection example in which a webpage contains a text file with
one linked image, and both files are stored on the same server; in this case, two separate TCP
connections are required — one for the text file and one for the image file. Each connection requires
its own connection establishment (TCP handshake), data transfer, and connection termination. This
illustrates that multiple objects require multiple connections when using a non-persistent approach,
leading to increased round-trip time (RTT) due to repeated handshakes, the need for additional
buffers and variables for each connection, and generally higher overhead, especially on the server
side.
A persistent connection, by contrast, keeps a single TCP connection open across multiple requests
and responses; the server keeps the connection open after sending a response, and the connection is
only closed either at the client's request or when a timeout occurs. The sender usually specifies the
length of the data being sent so the receiver knows when the response ends; however, for
dynamically generated documents where the length may not be known in advance, the server simply
closes the connection after transmission to signal the end of the data. Persistent connections save
time and network resources, require only one set of buffers and variables at each site, eliminate the
need for repeated connection establishment and termination, and ultimately reduce RTT and improve
overall performance.
Figure: Comparison of non-persistent and persistent HTTP connections for retrieving a webpage with multiple objects.
HTTP Request Message
An HTTP request message consists of four parts: the Request Line, the Header Lines, a Blank Line,
and an optional Body.
The Request Line contains three fields, separated by spaces and terminated by a CRLF (Carriage
Return and Line Feed) sequence: the Method, which specifies the type of request being sent by the
client; the URL, which specifies the address and name of the requested web page (for example,
"/[Link]") and identifies the exact resource to be accessed; and the Version, which specifies the
HTTP protocol version being used, with "HTTP/1.1" being the most common current version.
Zero or more Request Header Lines may follow the request line, providing additional information
from the client to the server and allowing the client to specify preferences and conditions for the
request. Header lines follow the general format "Header-Name: Value"; common examples include
"Host: [Link]," "Accept: text/html," "User-Agent: Chrome," and "If-Modified-Since:
Mon, 10 Jun 2025." The Blank Line separates the header section from the body section and marks
the end of the headers. The Body, which is optional, is present only in some request messages and is
most commonly used with PUT and POST methods; it may contain comments, form data, files to be
uploaded, or other information used to modify a resource on the server.
Figure: Structure of an HTTP request message — request line, header lines, blank line, and body.
The Status Line is the first line of a response message, following the format "Version SP Status-Code
SP Status-Phrase CRLF." The Version field specifies the HTTP protocol version used by the server,
typically "HTTP/1.1." The Status Code is a three-digit number that falls within a specific range
depending on its meaning: 100–199 indicates informational messages, 200–299 indicates a
successful request, 300–399 indicates redirection to another URL, 400–499 indicates a client-side
error, and 500–599 indicates a server-side error. Some commonly encountered status codes include
200 (OK), 301 (Moved Permanently), 302 (Found, or Temporary Redirect), 404 (Not Found), and 500
(Internal Server Error). The Status Phrase is simply a short textual explanation of the status code,
such as "200 OK," "404 Not Found," or "500 Internal Server Error."
Zero or more Response Header Lines may follow the status line, providing additional information
from the server to the client and describing either the returned document or the server itself, using the
same "Header-Name: Value" format as request headers. As with the request message, a Blank Line
separates the header section from the body section and marks the end of the headers. The Body,
when present, contains the actual document or data requested by the client, which may include
HTML pages, images, audio files, video files, or descriptive error messages.
Figure: Structure of an HTTP response message — status line, header lines, blank line, and body.
The FTP architecture uses a client-server model with two separate TCP connections rather than just
one. On the client side, the components include a User Interface, a Client Control Process, and a
Client Data Transfer Process; on the server side, the components include a Server Control Process
and a Server Data Transfer Process. The two connections used by FTP are the Control Connection,
which transfers commands and responses, and the Data Connection, which transfers the actual file
data. This separation of control information from data transfer is a key advantage of FTP, since it
makes the protocol more efficient and flexible.
Figure: FTP architecture — separate control connection and data connection between client and server.
The Control Connection in FTP remains open throughout the entire FTP session and is used for
sending commands and receiving responses; it uses the NVT ASCII character set, and each
command or response ends with a CRLF sequence. FTP uses two well-known port numbers: port 21
for the control connection and port 20 for the data connection. The Data Connection, by contrast, is
opened only when an actual file transfer is required and is closed once the transfer is complete; it can
be opened and closed multiple times during the course of a single FTP session, once for each file
transferred.
Figure: Lifetimes of the FTP control connection versus the data connection during a session.
The establishment of the data connection proceeds as follows: the client performs a passive open
using an ephemeral port; the client then sends this port number to the server using the PORT
command; and the server performs an active open using its own port 20 together with the client's
ephemeral port. Before any file transfer takes place, FTP also defines three additional characteristics:
the Data Structure, the File Type, and the Transmission Mode.
Regarding data structure, FTP supports a File Structure (the default), which treats the file as a
continuous stream of bytes; a Record Structure, in which the file is divided into records; and a Page
Structure, in which the file is divided into numbered pages. Regarding file types, FTP supports
ASCII files, EBCDIC files, and Image (binary) files. Regarding transmission modes, FTP supports
Stream Mode (the default), which transfers a continuous stream of bytes; Block Mode, in which data
is transferred in blocks with headers; and Compressed Mode, in which data is transferred in a
compressed form to save bandwidth.
FTP supports three basic file transfer operations: Retrieve, in which a file is transferred from the
server to the client; Store, in which a file is transferred from the client to the server; and Directory
Listing, in which directory information is sent from the server to the client so the user can see the
available files.
Figure: The three basic FTP operations — Retrieve, Store, and Directory Listing.
In a typical e-mail system, it would be neither practical nor logical for every user to run a server
program continuously and wait for incoming messages at all times, since users routinely switch off
their computers or disconnect from the network when they are not actively using them. To overcome
this limitation, e-mail communication relies on intermediate mail servers, which store, forward, and
deliver messages between users. The sender's e-mail client sends the message to a mail server, which
then transfers it onward to the recipient's mail server; when the recipient eventually becomes
available, they can access and retrieve the message using their own e-mail client.
Thus, e-mail implements the client-server model in an indirect manner: users run only client
programs whenever they need to send or receive messages, while dedicated mail servers handle the
actual storage and delivery of e-mails on their behalf. This approach allows reliable communication
to take place even when the sender and receiver are not online at the same time.
Figure: Indirect client-server model used by e-mail — intermediate mail servers store and forward messages.
Architecture of E-Mail
The architecture of an e-mail system consists of users, mail servers, mailboxes, queues, and different
software agents that all work together to send and receive messages. In a typical e-mail scenario, the
sender (commonly named Alice in textbook examples) and the receiver (commonly named Bob) are
each connected to their respective mail servers through a LAN or WAN. Each user has a mailbox on
their mail server, where received messages are stored, and a queue, or spool, where outgoing
messages wait before they are actually sent.
When Alice wants to send an e-mail, she uses a User Agent (UA) to compose and submit the
message to her own mail server. The message is then placed in a queue and subsequently transferred
across the Internet using a Mail Transfer Agent (MTA). The MTA follows the client-server model, in
which the client transfers the message to the destination mail server, while the server runs
continuously to accept incoming messages from many senders. Once the message reaches Bob's mail
server, it is stored in Bob's mailbox. To actually read the message, Bob uses a Message Access Agent
(MAA), which retrieves the message from the mail server. Unlike the MTA, which is described as a
push protocol because it pushes messages toward the destination server, the MAA is described as a
pull protocol because it allows the user to retrieve messages only when they choose to do so. This
overall architecture eliminates the need for users to keep their computers running continuously and
enables reliable e-mail communication even when the sender and receiver are never online at exactly
the same time.
Figure: Architecture of an e-mail system — User Agents, mail servers, mailboxes, queues, MTA, and MAA.
User agents can be broadly classified into two types: command-driven and GUI-based. Command-
driven user agents were commonly used in the early days of e-mail and required users to enter simple
keyboard commands to perform tasks; examples include mail, pine, and elm. Modern e-mail systems,
in contrast, use GUI-based user agents, which provide graphical elements such as icons, menus,
buttons, and windows, making e-mail operations far easier and more user-friendly; examples include
Microsoft Outlook and Eudora.
To send an e-mail, the user first creates the message using the User Agent. An e-mail is conceptually
similar to postal mail and consists of an envelope and a message. The envelope contains information
such as the sender's address, the receiver's address, and other delivery-related details. The message
itself contains two parts: a header, which includes information such as the sender, receiver, subject,
and other control details, and a body, which contains the actual content of the message. Once the
message has been prepared, the User Agent sends it onward to the mail server for delivery.
When receiving e-mail, the User Agent is activated either directly by the user or automatically
through a timer. If new mail is available in the mailbox, the User Agent notifies the user and displays
a list of the received messages, showing summary information such as the sender's e-mail address,
the subject line, and the date or time of receipt. The user can then select any message from this list
and view its complete contents on the screen. In this way, the User Agent greatly simplifies the
process of accessing and managing received e-mails.
Figure: Structure of an e-mail message — envelope, header, and body, as handled by the User Agent.
Electronic mail also supports mailing lists, also known as group lists, which allow a single name or
alias to represent multiple e-mail addresses at once. Instead of sending the same message
individually to several recipients, a user can simply send it to the mailing list alias. The e-mail
system then checks an alias database and automatically expands the alias into all of the individual e-
mail addresses associated with it, creating separate copies of the message for each member of
the group and
forwarding them to the Mail Transfer Agent (MTA) for delivery. Mailing lists simplify
communication with groups and make it far easier to send the same information to many recipients
simultaneously.
The standard Internet protocol used by the MTA is the Simple Mail Transfer Protocol (SMTP).
SMTP is actually used twice during the overall process of e-mail transmission: first, to transfer the
message from the sender's User Agent to the sender's own mail server, and second, to transfer the
message between the sender's mail server and the receiver's mail server. A different protocol, such as
POP or IMAP, is used later by the receiver specifically to access and download the message from
their mail server.
SMTP itself operates using a command-response mechanism. The MTA client sends commands to
the MTA server, and the server replies with appropriate responses; each command and response is
terminated by a two-character end-of-line sequence consisting of a carriage return (CR) and a line
feed (LF). Common SMTP commands include HELO (used to identify the client), MAIL FROM
(used to specify the sender's address), RCPT TO (used to specify the recipient's address), DATA
(used to indicate the start of the actual message content), and QUIT (used to terminate the session).
Responses are sent from the server back to the client in the form of three-digit status codes, often
accompanied by additional textual information describing the result of the command. In this way,
SMTP provides a reliable and standardized method for transferring e-mail messages across the
Internet.
During the Connection Establishment phase, the SMTP client first creates a TCP connection with the
SMTP server using port 25. The server then sends back a 220 (Service Ready) response to indicate
that it is ready to receive mail; if the service happens to be unavailable, the server instead sends a 421
response. Next, the client sends a HELO command, along with its own domain name, to identify
itself to the server, and the server acknowledges this by sending a 250 (Request Completed)
response, or another appropriate response code if there is a problem.
Once the connection has been established, the Message Transfer phase begins. The client sends a
MAIL FROM command containing the sender's e-mail address, and the server responds with a 250
code if the command is accepted. The client then sends a RCPT TO command specifying the
recipient's e-mail address, and the server again responds appropriately; if there are multiple
recipients, this step is simply repeated once for each additional recipient. After all recipients have
been specified, the client sends the DATA command to indicate the start of the actual message
content, and the server responds with 354 (Start Mail Input), which allows the client to begin
transmitting the message text.
The actual message is then sent line by line, with each line ending in a carriage return and line feed
(CRLF) sequence; the end of the entire message is indicated by a line containing only a single period
("."). After receiving the complete message, the server sends back a 250 (OK) response to confirm
successful receipt. Finally, in the Connection Termination phase, the client ends the SMTP session
by sending the QUIT command, and the server responds with a 221 code to indicate that the
connection is being closed, after which the underlying TCP connection is terminated. These three
phases together ensure the reliable and orderly transfer of e-mail messages between mail servers on
the Internet.
Since the Internet contains billions of connected devices, maintaining a single, centralized directory
for all of them would be both impractical and unreliable. Instead, DNS distributes its database across
many DNS servers located all around the world. This distributed approach improves efficiency,
scalability, and reliability, because users can access a nearby DNS server for faster resolution, and
the failure of any single server does not bring down the entire naming system.
When a user wants to access a remote service, such as a file transfer server, the user typically knows
only the server's domain name and not its actual IP address. The process begins when the user enters
the host name into a client application, such as an FTP client. The client passes this host name to a
DNS client on the local machine, which sends a query to a DNS server whose address is already
known to the computer. The DNS server searches its database and returns the corresponding IP
address of the requested host. The DNS client then provides this IP address to the application client,
which finally uses it to establish an actual connection with the remote server. In this way, DNS
serves as a vital
Internet service that allows users to access resources using easy-to-remember names, while still
allowing the underlying TCP/IP protocols to operate purely in terms of numerical IP addresses.
Figure: DNS name resolution — a client queries a DNS server to translate a domain name into an IP address before
contacting the destination server.
Before a client can connect to a remote server such as a file transfer server, the server's domain name
must first be translated into an IP address using DNS. This means that at least two connections are
required overall: the first between the DNS client and the DNS server, used purely for name
resolution, and the second between the actual application client and application server, used for the
real data transfer. In some cases, DNS may require additional connections to other DNS servers
before the correct IP address can finally be found.
To implement this kind of hierarchical naming system, the Internet uses a Domain Name Space,
which is organized as an inverted tree structure with a single root at the top. Each node in this tree
has a label, which can contain up to 63 characters, and the labels of sibling nodes under the same
parent must all be different from one another to guarantee uniqueness. Every node in the tree also has
a domain name,
formed by concatenating the labels along the path from that node up toward the root, separated by
dots. Domain names are conventionally read from the node itself toward the root. A complete
domain name that ends with the root label (represented by a trailing dot) is called a fully qualified
domain name (FQDN). This hierarchical structure allows DNS to efficiently organize and manage
millions of domain names across the entire Internet.
Figure: The Domain Name Space represented as an inverted tree, with the root at the top and labeled nodes below.
Figure: Formation of a domain name by concatenating labels from a node up to the root.
Figure: Example of a fully qualified domain name (FQDN) ending with the root label.
A zone is the specific portion of the DNS name space for which a particular DNS server is
responsible. If a domain has not been divided into any subdomains, the domain and the zone are
effectively the same thing. However, when a domain is divided and authority over parts of it is
delegated to lower-level servers, the original server retains only partial information, while the
detailed information about each subdomain is maintained by the servers specifically responsible for
those subdomains. This distributed approach improves the overall efficiency, scalability, and
reliability of the DNS system.
Figure: Division of the DNS name space into domains, subdomains, and zones of authority.
A Root Server is a DNS server whose zone of authority covers the entire domain name space. Rather
than storing detailed information about every domain itself, a root server delegates authority to
lower-level DNS servers and simply maintains references to them. Multiple root servers are
deliberately
distributed across the world in order to improve the overall reliability and availability of the DNS
system.
DNS uses two types of authoritative servers: Primary Servers and Secondary Servers. A Primary
Server stores the original zone file and is responsible for creating, maintaining, and updating that file.
A Secondary Server, by contrast, obtains a copy of the zone file from a primary server (or from
another secondary server) and stores it locally; secondary servers cannot themselves modify the zone
file, so any updates must be made on the primary server first and then transferred to the secondary
servers. Both primary and secondary servers are considered authoritative for their respective zones.
The purpose of secondary servers is to provide redundancy and improve overall reliability, ensuring
that DNS services continue to function even if the primary server happens to fail. It is also possible
for a single server to act as a primary server for one zone while simultaneously acting as a secondary
server for a different zone.
Figure: Relationship between a Primary DNS server and its Secondary (redundant) servers for a given zone.
Generic Domains classify hosts based on their general purpose or the type of organization they
belong to, and each domain in the DNS hierarchy effectively acts as an index into the overall domain
name space database. Common generic domains include ".com" for commercial organizations, ".edu"
for educational institutions, ".org" for non-profit organizations, ".gov" for government agencies, and
".net" for network service providers. These generic domains help organize and identify different
types of Internet resources efficiently.
Figure: Classification of the DNS name space into generic domains, country domains, and (deprecated) inverse domains.
● Extra point: Country domains, such as ".in" for India, ".uk" for the United Kingdom, and
".us" for the United States, use a two-letter country code as defined by ISO 3166.
● Extra point: DNS resolution typically involves recursive and iterative queries between a local
resolver, root servers, top-level domain (TLD) servers, and authoritative servers, culminating
in the final IP address being returned to the client.
A Peer-to-Peer (P2P) network can be more precisely defined as a distributed network in which
Internet users share resources directly with one another. When a peer possesses a file — such as an
audio file, a video file, or a document — it makes that file available to other peers on the network.
Any interested peer can then connect directly to the computer storing the file and download it; once
downloaded, that peer can also share the same file with other peers, which increases the total number
of copies available across the network over time. Because peers continuously join and leave the
network, maintaining accurate information about which peers are currently active and which files
they hold becomes an important ongoing challenge. Based on how this information is managed, P2P
networks can be classified into centralized and decentralized networks.
Figure: A centralized P2P network — a central server maintains the directory while file transfer occurs directly between
peers.
Although centralized P2P networks simplify file searching and directory management considerably,
they also carry several disadvantages. The central server can become a performance bottleneck due
to heavy traffic, and it is also vulnerable to attacks and outright failures — if the central server
becomes unavailable, the entire network may stop functioning altogether. Napster was the most well-
known example of a centralized P2P network, and its reliance on central servers ultimately
contributed to significant legal and operational challenges, eventually leading to its shutdown in
2001.
In a Structured P2P Network, peers are instead connected according to a set of predefined rules,
which enables considerably faster and more efficient file searches compared to the unstructured
approach. These networks commonly rely on a Distributed Hash Table (DHT) to organize and locate
resources across the network. DHT technology is widely used not only in P2P file-sharing
applications but also in distributed databases, content distribution systems, and DNS. BitTorrent is a
popular example of a structured P2P network that uses a DHT for efficient resource discovery and
file sharing.
The group of peers participating in the sharing of a particular file is called a swarm. A peer that
possesses the complete file is known as a seed, while a peer that has downloaded only some parts of
the file, and is still downloading the rest, is called a leech. As peers download individual chunks,
they also simultaneously upload those same chunks to other peers, creating a genuinely collaborative
sharing environment rather than a one-directional download.
In the original BitTorrent design, a central entity called a tracker manages the swarm for a particular
file. When a new peer wants to download a file, it first obtains a torrent file, or metafile, containing
information about the individual file pieces and the tracker's network address. The peer then contacts
the tracker, which provides it with a list of neighboring peers already participating in that torrent.
The new peer downloads the missing chunks from these peers and simultaneously uploads any
chunks it already has available to others. Once all the chunks have been collected, the peer itself
becomes a seed and can continue to help other users complete their downloads.
BitTorrent uses several strategies to ensure fairness and efficient utilization of network resources.
Each peer maintains active connections with only a limited number of neighbors, typically around
four, in order to avoid overloading the network. Peers are categorized as either unchoked (meaning
they have active connections) or choked (meaning their connections are currently inactive); every
few seconds, each peer evaluates its neighboring nodes and prefers to exchange data with those
offering better
transfer rates. BitTorrent also uses a technique called optimistic unchoking, which periodically
allows a brand-new peer to receive data even though it has not yet contributed anything to the
swarm, helping new peers get started. Another important strategy is the rarest-first policy, in which
peers prioritize downloading the least commonly available pieces first, which helps ensure a more
balanced distribution of file chunks throughout the entire swarm.
One notable limitation of the original BitTorrent system was its dependence on a single tracker: if the
tracker failed, new peers were unable to join the swarm at all. To overcome this problem, modern
BitTorrent implementations instead use a Distributed Hash Table, particularly the Kademlia DHT
algorithm, in which the tracking function is distributed among multiple peers rather than being
concentrated on a single central server. A joining peer sends a request to the DHT network, which
locates the responsible node and returns a list of peers already participating in that torrent. This
eliminates the single point of failure that existed in the original design and significantly improves the
scalability and reliability of the protocol.
In conclusion, BitTorrent is an efficient and highly scalable P2P file-sharing protocol that distributes
the overall workload among all participating peers. By dividing files into small chunks and actively
encouraging peers to both upload and download data simultaneously, BitTorrent achieves faster
transfers and much better utilization of available resources compared to traditional download
methods. The subsequent introduction of trackerless operation using DHT further enhanced its
reliability by removing the network's dependence on any single central tracker.
● Extra point: BitTorrent clients typically use a "tit-for-tat" strategy at the chunk-exchange
level, closely related to unchoking, to discourage free-riding (peers who only download
without uploading).
● Extra point: Magnet links are a modern alternative to traditional .torrent files; they contain a
cryptographic hash of the content and allow a peer to locate the swarm directly through the
DHT without needing to download a separate metafile first.