MAILA AZAM
241121
WEB TECHNOLOGY LAB
Q.1 Stateful vs. Stateless application-layer protocols advantages
& disadvantages (with examples)
STATELESS PROTOCOL: The server does not keep information about past
requests. Each request is independent.
Example: HTTP (basic web requests) is stateless, each is treated alone.
STATEFUL PROTOCOL: The server (or both sides) keeps information
about the session or past interactions. The server remembers things
between messages.
Example: FTP
PROTOCOL TYPE ADVANTAGES DISADVANTAGES
Easy to scale, simple Client must send
server design, fault repeated information,
Stateless tolerant, uses less harder for multi-step
memory per client interactions, needs
extra cookies
Easier multi-step Uses more server
Stateful interactions, server resources, harder to
remembers context, scale, complex failure
reduces repeated handling, session data
data, good for real- can be a security risk
time apps
Q.2 Compare and contrast the roles and responsibilities of the
application layer and transport layer in a computer network. How
do they work together to ensure reliable data communication?
Feature Application Layer Transport Layer
Main Provides services to the Provides logical
user and their applications communication between
Responsibility
(e.g., web browsing, email). application processes
running on different hosts.
What it deals The meaning and structure The movement of the data
of the data (the (the "packets").
with
"message").
Segment (for TCP) or
Message Datagram (for UDP)
Data Unit
- Process-to-process
delivery using port
- Defining protocols like numbers.
Key Functions HTTP, SMTP, FTP. - Connection-oriented
- Interpreting user data. (TCP) or connectionless
(UDP) service.
- Reliable data transfer
(TCP).
The content of a The postal service that
letter (the words and their ensures the envelope is
Analogy
meaning). delivered to the right
address, in order, and
without damage.
How They Work Together
Think of it like sending a physical letter:
1. You Write the Letter (Application Layer): You write the actual
message—the words, the meaning. This is what the application
layer does (like your email app creating an email).
2. You Give it to the Postal Service (Transport Layer): You put the
letter in an envelope, write the address, and drop it in a mailbox.
You trust the postal service to handle the delivery. Similarly, the
application layer hands its data to the transport layer.
3. The Postal Service Delivers It (Transport Layer's Job): The
transport layer (like TCP) is the postal service. It makes sure the
letter...
o Gets to the right address (using port numbers).
o Arrives in order if you sent multiple letters.
o Gets re-sent if it gets lost.
Q.3 Create a network architecture diagram that illustrates how various
application layer protocols, such as HTTP, FTP, and SMTP, interact within a
typical internet communication scenario. Explain the flow of data
between the client and server.
CLIENT PC
( USER DEVICE )
HTTP (80) FTP ( 21 )
Web Server Main Server FIP Server
( HTTP ) SMTP / POP3 ( FTP)
POP (110) SMPTP (25)
Data Flow Summary
1. Web Browsing (HTTP): When you type a website address, your browser
sends an HTTP request to the Web Server. The server then sends back the
website pages and pictures for your browser to show.
2. File Transfer (FTP): When you upload a file, your FTP client connects to
the FTP Server on port 21, logs in, and transfers the file directly.
3. Sending Email (SMTP): When you send an email, your email app
uses SMTP to hand the message off to the Mail Server, which is like
dropping a letter in the post office box.
4. Receiving Email (POP3): To get your new emails, your email app
uses POP3 to connect to the Mail Server on port 110 and download them
to your computer.
Q.4 Describe how a botnet can be created and how it can
be used for a DdoS attack.
How a Botnet is Made:
1. Create the Virus: A hacker writes a special virus or malware called a "bot."
2. Spread the Infection: They spread this bot to thousands of normal people's
computers. This happens through tricky emails, bad websites, or infected
software downloads.
3. Take Control: Once the bot is on a computer, it secretly contacts the
hacker's main server (the "command and control" center). That computer is
now a "zombie" in the hacker's "botnet."
How it Does a DDoS Attack:
A DDoS (Distributed Denial-of-Service) attack is like crowding a shop's entrance
with so many fake customers that real customers can't get in.
1. The Order: The hacker picks a target, like a popular website. They send one
command from their control server to all the thousands of zombie
computers in their botnet.
2. The Attack: All the zombie computers instantly start sending endless
useless requests to the target website.
3. The Result: The website's server is completely overwhelmed by the fake
traffic. It can't tell what's real and what's fake, so it slows to a crawl or
crashes. This means real users can't access the site anymore.