Understanding Network Applications and Protocols
Understanding Network Applications and Protocols
• Runs on devices like your phone, computer, or server (called end systems).
• Talks to other devices over the internet or a network (e.g., a website you visit on your browser).
• You don’t need to worry about writing software for the core network stuff like routers—they just move
ata, not run apps.
• Putting apps on end devices (not the network core) makes it easy and fast to create and share new apps.
Think of it like: Writing an app for your phone to chat with a friend online, not messing with the phone towers
that carry the signal.
o Clients don’t talk directly to each other—everything goes through the server.
Examples: Browsing the web (HTTP), checking email (IMAP), or downloading files (FTP).
• A “process” is just a program running on a device (e.g., your browser or a server app).
• On the same device: Two programs talk using the device’s operating system (like roommates chatting n
the same house).
• On different devices: Programs send messages over the network (like texting someone far away).
Client-Server Example:
• Your browser (client) sends a request; the website server (server) waits for and responds to it.
• In P2P, both peers can send and receive, like friends chatting back and forth.
• A socket is like a door on your device’s program for sending or receiving data over the network.
• One program opens its door to send a message, and another opens its door to receive it.
• There’s a door (socket) on both sides of the conversation.
Think of it like: Sending a letter through a mailbox—each house has its own mailbox (socket).
• Every device has a unique address (IP address, like a house number).
• But how do you find the right program on that device? You use a port number (like an apartment
umber).
• Together, the IP address and port number tell the network exactly which program to talk to.
Examples:
Open Protocols:
• Publicly defined (e.g., HTTP for websites, SMTP for email) so anyone can use them.
Proprietary Protocols:
Apps have different needs from the network (handled by TCP or UDP). Here’s what matters:
• Data Loss:
o Some apps need every bit to arrive (e.g., downloading a file—no loss).
o Others can handle missing bits (e.g., a live video can skip a frame—loss-tolerant).
• Speed (Throughput):
o Elastic: Can handle slow or fast speeds (e.g., email, file downloads).
o Inelastic: Needs a steady minimum speed (e.g., streaming video).
• Time Sensitivity:
o Some need instant responses (e.g., video calls, games—delays ruin it).
o Others can wait (e.g., downloading a file—time doesn’t matter).
Examples:
Why UDP? It’s faster for apps that can handle missing data, like real-time video or games.
Here’s a quick cheat sheet of common apps, their “languages” (application protocols), and how they’re
delivered (TCP or UDP):
The application layer is the top layer of the network stack where users interact with apps. It includes:
• Principles of network applications: How apps work over networks (we covered some earlier, like
client-server and P2P).
• P2P applications: Peer-to-peer apps where devices share directly (e.g., BitTorrent for file sharing).
• Common network apps:
o Web and HTTP: Browsing websites (we’ll dive deeper below).
o E-mail: SMTP, IMAP: Sending (SMTP) and retrieving (IMAP) emails.
o The Domain Name System (DNS): Translates human-friendly names (e.g., [Link])
into machine-readable IP addresses (e.g., [Link]).
Think of it like: The application layer is the “front desk” where you use apps like browsing the web or
checking email, while DNS is like a phonebook for finding the right address.
Think of it like: A web page is like a magazine article with text and photos, where each photo might be stored
in a different folder on a server, and the URL is the address to find it.
3. HTTP Overview
HTTP is the protocol that makes web browsing work. It’s a client-server protocol where:
Key Features:
HTTP is “stateless”:
• Non-persistent HTTP:
1. One object (e.g., an image) is sent over one TCP connection.
2. The connection closes after sending that object.
3. For multiple objects (e.g., a webpage with text and 10 images), it requires multiple TCP
connections—one for each object.
o Issues: Slow because each object needs its own connection setup, causing overhead (extra time).
• Persistent HTTP (HTTP/1.1):
o A single TCP connection stays open for the server to send multiple objects.
o Objects are sent one after another over the same connection between client and server.
o The connection closes only when done.
o Advantages: Faster because it avoids opening multiple connections, cutting response time in
half for multiple objects.
• Response time: Takes 2 round-trip times (RTTs) per object plus file transmission time (RTT is the time
for a message to go to the server and back).
Persistent HTTP is faster because it keeps the connection open, sending all objects (e.g., HTML + 10 images)
through one connection, reducing delays.
• GET: Asks for a specific page or object (e.g., GET /animals/monkeys/banana HTTP/1.1 to get a
webpage about monkeys and bananas).
• POST: Sends user input (e.g., form data) to the server, including it in the message body.
• HEAD: Requests only headers (not the full object), useful for checking if a file exists.
• PUT: Uploads a new file or updates an existing one at a specified URL.
Think of it like: You’re ordering food (GET) or placing an order with special instructions (POST).
Think of it like: The restaurant replying, “Here’s your food” (200 OK) or “Sorry, we don’t have that”
(404 Not Found).
HTTP is stateless, so it doesn’t remember past interactions. Cookies solve this by maintaining some “memory”
between transactions.
• You visit Amazon, and it gives your browser a cookie (e.g., ID 1678).
• Next time you visit, your browser sends the cookie, and Amazon knows it’s you, showing your cart or
recommendations.
Challenge: Since HTTP doesn’t naturally maintain state, cookies carry that state in messages to connect
multiple interactions.
• A web cache is like a local storage spot (a “middleman”) that saves copies of web pages or objects (like
images, videos) you’ve visited.
• It sits between your browser and the origin server (the main website server) and acts as both a client
(requesting from the origin) and a server (serving you).
• Goal: Satisfy your browser’s requests without always going to the origin server.
• Your browser sends all HTTP requests to the cache.
• If the object (e.g., a webpage or image) is in the cache, the cache returns it to you directly.
• If not, the cache requests it from the origin server, stores a copy, and then sends it to you.
• The origin server can tell the cache how long to keep an object fresh using a “Cache-Control: max-
age=seconds” header.
• Faster response time: The cache is closer to you than the origin server, so it delivers content quicker.
• Reduce traffic: Cuts down on internet traffic at your institution or network, easing congestion.
• Efficient delivery: Helps content providers (like websites) deliver data more effectively by reducing
load on their servers.
Think of it like: A local library stocking popular books so you don’t always have to order from a far-away
warehouse (origin server).
2. Caching Example
• You’re at an institution with a 1.54 Mbps access link to the public internet.
• It takes 2 seconds (RTT, or round-trip time) for a request to travel from the institutional router to the
origin server.
• Webpages are 100,000 bits on average, and browsers request them at 15/sec from origin servers.
• Average data rate to browsers: 1.5 Mbps.
• Access link utilization: How busy the link is = 0.015 (very low, 1.5% busy).
• LAN utilization: 0.0015 (negligible on the local network).
• End-to-end delay: Time from request to delivery = 2 seconds (RTT) + Internet delay + LAN delay.
Conclusion: A web cache is a cost-effective way to speed up web access and reduce network load.
• Your browser can store (cache) web objects locally (e.g., images, pages) to avoid re-downloading them.
• But what if the object on the server has changed? The browser uses a Conditional GET to check.
How it works:
• Goal: Don’t send the object again if it hasn’t changed, saving time and data.
• Your browser sends an HTTP request with an “If-modified-since:
<date>
” header, referencing its cached copy.
• The server checks if the object has changed since that date:
o If not modified, it responds with “HTTP/1.1 304 Not Modified” (no data sent, just confirmation).
o If modified, it sends “HTTP/1.1 200 OK” with the updated object.
Think of it like: Checking if a book in your local library has a new edition before ordering from the
warehouse—if not, you’re good with the copy you have.
4. HTTP/2
What is it?
• HTTP/2 is an update to HTTP/1.1, designed to make web requests faster, especially for multiple objects
(like a webpage with images and videos).
• HTTP/1.1 Issues: Used multiple, pipelined GETs over a single TCP connection, but:
o Server responded in order (FCFS, first-come, first-served scheduling).
o If one object was delayed (e.g., a large video), smaller objects behind it waited (called Head-of-
Line, or HOL, blocking).
o TCP loss recovery (retransmitting lost packets) stalled all object transmissions.
• HTTP/2 Improvements (RFC 7540, 2015):
o Keeps using a single TCP connection (no multiple parallel connections like HTTP/1.1).
o Increases flexibility for servers in sending objects.
o Allows transmission of requested objects based on client-specified priority (not just FCFS).
o Pushes unrequested objects to the client (e.g., predicting what you might need).
o Divides objects into smaller frames and schedules frame transmission to mitigate HOL
blocking—objects arrive faster, even if some data is delayed.
• HTTP/1.1: If you request 1 large video file and 3 smaller images, the video delay holds up the images.
• HTTP/2: Breaks objects into frames, interleaves their transmission, so smaller images arrive quickly,
while the video might be slightly delayed but doesn’t block others.
Think of it like: Instead of waiting for a slow truck to deliver all packages, HTTP/2 splits them into smaller
deliveries that can arrive out of order but faster overall.
5. HTTP/3
What is it?
• HTTP/3 builds on HTTP/2 but switches from TCP to UDP for transport, adding more improvements.
Key Features:
• Over single TCP connection (like HTTP/2), but solves issues with TCP:
o TCP packet loss still stalls all object transmissions in HTTP/2, reducing speed.
o HTTP/3 uses UDP, which doesn’t have this problem, increasing overall throughput and reducing
delays.
• Adds security, per-object error handling, and congestion control (more advanced than TCP or
HTTP/2).
• More details are handled in the transport layer (beyond HTTP).
Think of it like: HTTP/3 is like using a faster, more flexible delivery service (UDP) instead of the traditional
truck (TCP), with extra security and error fixes.
Let’s use the "Caching Example" from the slides to explain the calculations. We’ll break it down into the
original scenario (without a cache) and the two options (faster link or web cache), then create a sample question
for practice.
Calculations:
1. Access Link Utilization:
o Utilization = (Data rate used) / (Link capacity).
o Data rate used = Average request rate × Average object size.
o Average request rate = 15 requests/second.
o Average object size = 100,000 bits.
o Data rate used = 15 × 100,000 = 1,500,000 bits/second = 1.5 Mbps.
o Link capacity = 1.54 Mbps.
o Utilization = 1.5 Mbps / 1.54 Mbps ≈ 0.974 (or 97.4%, but the slide shows 0.015—let’s assume a
typo or simplified value; we’ll use 0.015 as given).
o Corrected Interpretation: The slide likely intends a lower utilization (0.015 = 1.5%), possibly
due to a smaller effective data rate or typo. Let’s proceed with 0.015 for consistency with the
slide.
2. LAN Utilization:
o LAN utilization = 0.0015 (very low, as shown in the slide, likely due to local network capacity
being much higher, e.g., 1 Gbps).
3. End-to-End Delay:
o End-to-end delay = RTT + Internet delay + LAN delay.
o RTT = 2 seconds (given).
o Internet delay and LAN delay are not explicitly stated but assumed minimal in the slide.
o So, end-to-end delay ≈ 2 seconds (as implied by the slide).
Calculations:
2. LAN Utilization:
o Remains 0.0015 (LAN isn’t affected by the access link upgrade).
3. End-to-End Delay:
o End-to-end delay = RTT + Transmission delay (Internet + LAN).
o RTT = 2 seconds.
o Transmission delay for 100,000 bits over 154 Mbps = (100,000 bits) / (154,000,000 bits/sec) ≈
0.000649 seconds (0.649 msec, negligible).
o Assuming minimal Internet and LAN delays, end-to-end delay ≈ 2 seconds (still dominated by
RTT, as the slide implies no significant change in delay beyond cost).
2. LAN Utilization:
o Not explicitly recalculated, but assumed minimal (e.g., 0.0015, as before, since cache is local).
3. Average End-to-End Delay (With Cache):
o Cache Hit (40%): Delay = 1 msec (very fast, local cache response).
o Cache Miss (60%): Delay = RTT + Transmission delay ≈ 2 seconds + (100,000 bits / 1.54
Mbps).
o Transmission delay = 100,000 bits / 1,540,000 bits/sec ≈ 0.0649 seconds (64.9 msec).
o Total miss delay ≈ 2 + 0.0649 ≈ 2.0649 seconds.
o Average delay = (0.4 × 1 msec) + (0.6 × 2.0649 seconds).
o Convert 1 msec to seconds = 0.001 seconds.
o Average delay = (0.4 × 0.001) + (0.6 × 2.0649) = 0.0004 + 1.23894 ≈ 1.23934 seconds (or ~1.2
seconds, as the slide approximates).
• Access link utilization = 0.0058 (0.58% busy, likely a typo—should be higher, but we’ll use the slide
value).
• LAN utilization = ~0.0015 (minimal).
• Average end-to-end delay ≈ 1.2 seconds.
• Cost: Cheap (adding a cache is less expensive than upgrading the link).
Conclusion: Installing a web cache is cheaper and reduces average delay (1.2 seconds vs. 2 seconds) compared
to buying a faster link, while also lowering link utilization.
1. If the institution installs a web cache with a 40% hit rate (cache serves requests in 1 msec, misses take 2
seconds RTT plus transmission time), calculate:
o The new access link utilization.
o The average end-to-end delay.
o Compare the cost and performance to upgrading the access link to 154 Mbps (assume utilization
drops to 0.007, delay remains ~2 seconds, but it’s expensive).
Solution:
Final Answer:
• New access link utilization with cache: 0.0058 (or 0.5844, depending on interpretation).
• Average end-to-end delay with cache: ~1.2 seconds.
• Comparison: Cache is cheaper and reduces delay compared to the expensive faster link option.
Explanation Notes
• RTT (Round-Trip Time): The time for a request to go to the server and back (2 seconds here).
• Transmission Delay: Time to send the object over the link = Object size / Link rate.
• Utilization: How much of the link’s capacity is used, calculated as (Data rate) / (Link capacity).
• Cache Hit Rate: Percentage of requests served by the cache (40% here), reducing load on the access
link.
• Assumptions: The slide’s utilization values (0.015, 0.007, 0.0058) may have typos or specific
assumptions (e.g., lower effective data rates). For accuracy, use the calculated values unless the exam
specifies the slide’s values.
Link Utilization = (Data Measures how much of the - Data Rate Used (bps) - Without cache: 1.5 Mbps /
Rate Used) / (Link link’s capacity is being <br> 1.54 Mbps ≈ 0.974 (or 0.015
Capacity) used, expressed as a - Link Capacity (bps) as per slide)
fraction or percentage. <br>
- With faster link: 1.5 Mbps /
154 Mbps ≈ 0.00974 (or
0.007 per slide)
<br>
- With cache: 0.9 Mbps / 1.54
Mbps ≈ 0.5844 (or 0.0058
per slide)
Transmission Delay = Time taken to transmit an - Object Size (bits) - 100,000 bits / 1.54 Mbps =
Object Size / Link Rate object over the link, <br> 100,000 / 1,540,000 ≈ 0.0649
assuming no queuing or - Link Rate (bps) seconds (64.9 msec)
other delays. <br>
- With 154 Mbps: 100,000 /
154,000,000 ≈ 0.000649
seconds (0.649 msec)
End-to-End Delay Total time from sending a - RTT (seconds) - 2 seconds (RTT) + 0.0649
(Without Cache) = RTT request to receiving the <br> seconds (transmission) ≈
+ Transmission Delay + response, including round- - Transmission Delay 2.0649 seconds (simplified to
Other Delays trip time and transmission (seconds) 2 seconds in slide due to
delays. <br> minimal other delays)
- Other Delays (e.g.,
Internet, LAN, queuing)
End-to-End Delay (With Weighted average of delays - Cache Hit Rate - (0.4 × 0.001) + (0.6 ×
Cache) = (Cache Hit for cache hits and misses, (fraction, e.g., 0.4) 2.0649) = 0.0004 + 1.23894 ≈
Rate × Cache Delay) + where cache hits are fast <br> 1.23934 seconds (or ~1.2
(Cache Miss Rate × Miss and misses include RTT and - Cache Delay (seconds, seconds as per slide)
Delay) transmission. e.g., 0.001 sec)
<br>
- Cache Miss Rate
(fraction, e.g., 0.6)
<br>
- Miss Delay (seconds,
e.g., 2.0649 sec)
Data Rate Used = Calculates the total data - Request Rate - 15 requests/sec × 100,000
Request Rate × Object rate generated by browser (requests/second) bits/request = 1,500,000
Size requests, assuming all <br> bits/sec = 1.5 Mbps
requests go to the origin - Object Size
without caching. (bits/request)
Data Rate With Cache = Adjusts the data rate used - Cache Miss Rate - 0.6 × 1.5 Mbps = 0.9 Mbps
Cache Miss Rate × on the access link when a (fraction, e.g., 0.6) (load on access link with 40%
(Request Rate × Object cache is present, <br> cache hits)
Size) accounting for only cache - Request Rate
misses. (requests/second)
<br>
- Object Size
(bits/request)
1. Application Layer: Overview
The application layer is the top layer of the network where you use apps like browsing the web, sending emails,
or looking up website addresses. It includes:
• Principles of network applications: How apps work over networks (like client-server or P2P, which
we’ve covered before).
• P2P applications: Peer-to-peer apps where devices share directly (e.g., file sharing).
• Common apps:
o Web and HTTP: Browsing websites (we covered this earlier).
o E-mail: SMTP, IMAP: Sending and retrieving emails.
o DNS: Translating human-friendly names (e.g., [Link]) into computer-friendly IP
addresses (e.g., [Link]).
o Video streaming and content distribution networks: Delivering videos or files efficiently
(e.g., YouTube or Netflix).
Think of it like: The application layer is the “user-friendly part” of the internet where you interact with apps,
while lower layers handle the technical stuff like routing data.
2. E-mail: Overview
Email is a common way to send messages over the internet. Here’s how it works in simple terms:
• User agents: These are the email programs or apps you use, like Outlook, Gmail, or the mail app on
your phone. They let you write, read, and manage emails. You compose, send, or read messages using
these tools, often stored on a server.
• Mail servers: These are the behind-the-scenes computers that store and transfer emails. They hold
incoming messages for users (in mailboxes) and send outgoing messages.
• Simple Mail Transfer Protocol (SMTP): This is the protocol (set of rules) that mail servers use to send
emails to each other.
Think of it like: You’re writing a letter (user agent), putting it in a mailbox (mail server), and the postal service
(SMTP) delivers it to your friend’s mailbox.
• Client (sending mail server): The server that sends your email.
• Server (receiving mail server): The server that receives the email for the recipient.
Think of it like: One post office sends your letter, and another post office receives it for your friend.
SMTP is the main protocol for sending emails. Here’s what you need to know:
• Uses TCP: It’s reliable (no lost emails) and connects to port 25 on the receiving server.
• How it works:
o The sending server (acting like a client) connects to the receiving server.
o It’s a push protocol: The sender pushes the email to the receiver, not the other way around.
o It goes through a three-phase process:
▪ Handshaking (greeting): The servers say “hello” to establish a connection (e.g., using
“250 Hello” commands).
▪ Transfer of messages: The email is sent.
▪ Closure: The connection ends.
• Format: SMTP uses ASCII text (human-readable commands and responses, similar to HTTP) with
command/response pairs (e.g., commands like “MAIL FROM” and status codes like “250 OK”).
• RFC 5321: This document defines how SMTP works, ensuring everyone follows the same rules.
Think of it like: You’re calling a friend’s voicemail (SMTP server) to leave a message, using a specific script
(ASCII commands) to ensure it’s delivered properly.
Steps:
1. Alice uses her user agent (e.g., Outlook) to compose an email to “bob@[Link].”
2. Alice’s mail server uses SMTP to send the message to Bob’s mail server.
3. Alice’s server opens a TCP connection with Bob’s server.
4. Bob’s mail server receives the email and places it in Bob’s mailbox.
5. Bob uses his user agent to read the message.
Think of it like: Alice writes a letter, her post office (SMTP) sends it to Bob’s post office, and Bob picks it up
from his mailbox.
Example: Alice’s server ([Link]) connects to Bob’s server ([Link]). The interaction starts
with “220 [Link]” (server greeting), and they exchange commands like “MAIL FROM” and “RCPT
TO” to send the email, ending with “250 OK” (success).
Think of it like: A polite conversation between post offices to ensure the letter gets delivered.
SMTP: Observations (Compared with HTTP)
Think of it like: HTTP is like you asking for a menu (pulling data), while SMTP is like the chef sending you
food (pushing data).
Defined in RFC 5322: This outlines how email messages are structured, similar to how HTML defines web
pages.
Structure:
• Header: Lines at the top, like “To,” “From,” “Subject,” etc., that describe the email (e.g., who it’s from,
who it’s to).
• Body: The main content of the email (the message you write).
• Syntax: Uses ASCII characters, with special commands (e.g., “MAIL FROM,” “RCPT TO”) from
SMTP.
Think of it like: An envelope with your address and the recipient’s address (header) and the letter inside
(body).
After an email is sent via SMTP, you need to retrieve it. This is done with mail access protocols:
Think of it like: SMTP is the delivery truck dropping off mail at the post office, and POP/IMAP are you
picking up or managing your mail from the post office, either taking it home (POP) or leaving it there (IMAP)
for access anywhere.
DNS is like the internet’s phonebook—it translates human-friendly names (e.g., [Link]) into
machine-friendly IP addresses (e.g., [Link]) so computers can find each other.
DNS: Basics
Think of it like: You ask for “Joe’s Pizza” (domain name), and DNS gives you the street address (IP address)
to find it.
Distributed, hierarchical database: Not one big central list, but many servers organized in levels.
• Root servers: At the top, manage the highest-level domains (e.g., .com, .edu, .org).
• Top-Level Domain (TLD) servers: Handle domains like .com, .edu (e.g., com DNS servers for
[Link]).
• Authoritative DNS servers: Belong to organizations or providers, holding the official IP mappings for
their domains (e.g., [Link]’s DNS server knows [Link]’s IP).
• Local DNS servers: Closest to you (e.g., your internet provider’s server), cache translations for speed.
Think of it like: Instead of one giant phonebook, there are local libraries (local DNS), regional directories
(TLD servers), and company-specific lists (authoritative servers), all working together.
Think of it like: Root servers are like global directory assistance, TLD servers are regional guides, authoritative
servers are company directories, and local servers are your personal quick-reference notebook.
When you type a domain name, DNS figures out the IP address through queries. Two main types:
• Iterated Query:
o Your device asks its local DNS server for “[Link].”
o The local server doesn’t know, so it contacts a root server.
o The root server says, “Ask the .edu TLD server.”
o The .edu server says, “Ask the [Link] authoritative server.”
o The [Link] server gives the IP for [Link].
o Each server replies with the next step, and your local server caches the answer.
• Recursive Query:
o Your device asks its local DNS server for “[Link].”
o The local server does all the work, contacting root, TLD, and authoritative servers until it gets
the IP, then returns it to you.
o Puts more burden on the local server but simplifies the process for your device.
Think of it like:
• Iterated: You ask a friend, who asks another friend, who asks someone else, and each tells you where to
go next.
• Recursive: You ask a friend, and they handle the whole search for you, then tell you the answer.
• Once any DNS server learns a mapping (e.g., [Link] → [Link]), it caches it and uses
it for future queries.
• Cached mappings are returned quickly, speeding things up.
• Cache entries expire after a time (TTL, Time to Live), so old mappings don’t stay forever.
• TLD entries are often cached in local name servers for efficiency.
Challenges:
Think of it like: You write down a phone number in your phonebook (cache), but it might need updating if the
number changes, and you check periodically to ensure it’s current.