A process is a program running within a host. Processes
communicate via sockets (API to the network). To
identify a socket, we need both the IP address (host)
and a port number (e.g., HTTP:80, SMTP:25).
Application-layer protocol defines: message types
(request/response), syntax (fields and delimiters), semantics (meaning
of fields), and rules for when/how processes send messages.
📡 What transport service does an app need?
Data integrity: some apps (file transfer, web) need
100% reliable transfer; others (audio) tolerate some loss.
Timing: low delay is critical for Internet telephony,
interactive games.
Throughput: multimedia apps require minimum
throughput; elastic apps use whatever is available.
Security: encryption, data integrity, authentication
(e.g., TLS).
HTTP/1.1 200 OK
Date: Mon, 10 Mar 2025 12:00:00 GMT
Server: Apache/2.4
Content-Type: text/html
Content-Length: 1024
(html data...)
Status codes: 200 OK, 301 Moved Permanently, 400 Bad
Request, 404 Not Found, 505 HTTP Version Not Supported.
🍪 Cookies – maintaining user/server state
HTTP is stateless; cookies add state via:
Cookie header in HTTP response (set by server)
Cookie header in next HTTP request (sent by browser)
Cookie file stored on user's host
Back-end database at website
Privacy note: Third-party cookies can track users
across sites. GDPR gives users explicit control over cookie acceptance.
💾 Web Caching (Proxy Servers)
Web cache (proxy) stores copies of objects, reducing response time and
access link traffic. Browser sends requests to cache; if object is
fresh, cache returns it; otherwise cache fetches from origin server.
Conditional GET: client asks "If-modified-since",
server replies "304 Not Modified" if cached copy is up-to-date → saves
bandwidth.
QUIC (Quick UDP Internet Connections):
application-layer over UDP, integrates TLS + reliability + congestion
control, reduces handshake to 1 RTT (or 0 RTT).
3. E‑mail: SMTP and IMAP
Three major components: user agents (mail readers),
mail servers, and SMTP (Simple Mail
Transfer Protocol).
SMTP: uses TCP port 25, persistent connections, push
protocol (sending server pushes message to receiving server). Requires
7-bit ASCII.
Mail access protocols:
IMAP (retrieves, stores, manages messages on server)
or HTTP (web-based email like Gmail).
Sample SMTP interaction
S: 220 hamburger.edu
C: HELO crepes.fr
S: 250 Hello crepes.fr
C: MAIL FROM: <alice@crepes.fr>
S: 250 Sender ok
C: RCPT TO: <bob@hamburger.edu>
S: 250 Recipient ok
C: DATA
S: 354 Enter mail, end with "." on a line by itself
C: Do you like ketchup?
C: How about pickles?
C: .
S: 250 Message accepted for delivery
C: QUIT
S: 221 closing connection
4. Domain Name System (DNS)
DNS translates hostnames (e.g., www.example.com) to IP addresses. It is
a distributed hierarchical database implemented by many
name servers.
Root name servers (13 logical, heavily replicated) –
managed by ICANN.
Top-Level Domain (TLD) servers – for .com, .org,
.edu, country domains, etc.
Authoritative DNS servers – provide mapping for
specific organization’s hosts.
Local DNS server – not part of hierarchy, caches
results, acts as proxy.
DNS resolution: iterative vs. recursive
Iterated query: contacted server replies with name of
next server to ask. Recursive query: puts burden on
name server (rare in practice).
DNS records (Resource Records – RR)
A – hostname to IP address
NS – domain to authoritative name server hostname
CNAME – alias to canonical name
MX – mail server for domain
DNS security: Cache poisoning and DDoS attacks are
threats; DNSSEC provides authentication and integrity.
5. Video Streaming & Content Distribution
Networks (CDNs)
Streaming video dominates Internet traffic. Challenge:
deliver high-quality video to millions of heterogeneous users.
DASH (Dynamic Adaptive Streaming over HTTP)
Server splits video into chunks, each encoded at multiple bitrates.
Client dynamically requests the best chunk based on measured bandwidth
and buffer level.
Intelligence at client: avoids rebuffering, maximizes quality.
Content Distribution Networks (CDNs)
Replicate content across many geographically distributed servers
(e.g., Akamai, Cloudflare, Amazon CloudFront).
Enter deep: many small clusters near users;
Bring home: fewer large clusters in IXPs.
Netflix uses its own CDN (OpenConnect) to store content close to ISPs.
6. Socket Programming (UDP & TCP)
Socket = door between application process and transport
layer. Two main types: UDP socket (unreliable datagram) and TCP socket
(reliable byte stream).
UDP socket programming (Python)
Client attaches destination IP and port to each packet; no connection
setup.
# TCPServer.py
from socket import *
serverPort = 12000
serverSocket = socket(AF_INET, SOCK_STREAM)
serverSocket.bind(('', serverPort))
serverSocket.listen(1)
print('The server is ready to receive')
while True:
connectionSocket, addr = serverSocket.accept()
sentence = connectionSocket.recv(1024).decode()
capitalizedSentence = sentence.upper()
connectionSocket.send(capitalizedSentence.encode())
connectionSocket.close()
Timeouts: Use
socket.settimeout(seconds) and try-except to
handle unresponsive servers.
Homework Assignment (Theoretical, Graded)
Instructions: Answer all questions in a separate
document (PDF or Word). Submit via the learning platform. This
assignment counts towards your final grade (5%).
Part I: Short Essays (40 points)
Compare client-server and P2P architectures. Give two advantages and
two disadvantages of each.
Explain the difference between non-persistent HTTP and persistent
HTTP. Calculate the total response time for a web page with 10 small
images using non-persistent HTTP, given RTT = 100 ms and negligible
transmission time.
What is a cookie? How does it enable stateful behavior in HTTP?
Discuss privacy concerns related to third-party cookies.
Describe the role of DNS in the Internet. How does a local DNS
server help reduce resolution time?
What is DASH? Why is client-side adaptation critical for streaming
video over the Internet?
Part II: True/False + Correction (30 points)
SMTP is a pull protocol – the receiver’s mail server fetches
messages from the sender’s server.
UDP provides reliable, in-order delivery of data.
In HTTP/1.1, multiple objects can be sent over a single TCP
connection.
The DNS root servers are centralized and handle all DNS queries
directly.
Conditional GET allows a web cache to avoid downloading an object
that hasn’t changed.
For each false statement, write the correct version.
Part III: Calculations and Protocol Analysis (30 points)
Assume RTT = 50 ms and an HTML file of size 10 KB plus 5 images of
20 KB each. Using non-persistent HTTP (one object per connection),
compute total delay (ignore transmission time). Compare to
persistent HTTP (one connection, sequential requests).
Given a DNS hierarchy: Client queries local DNS, then root, then TLD
(.com), then authoritative. Assume RTT between each pair is 10 ms.
How long does iterative resolution take? Recursive resolution?
Write a Python UDP client that sends a message "HELLO" to server at
IP 127.0.0.1 port 9999, waits for response, and prints it. Include
error handling for timeout (2 seconds).
Grading criteria: correctness, completeness, proper
use of terminology, and clarity of explanation.
Transport service requirements: reliability, timing, throughput,
security.
TCP vs. UDP: reliable connection-oriented vs. unreliable datagram.
HTTP: stateless, persistent connections, cookies for state, web
caching, HTTP/2, QUIC.
Email: SMTP (push), IMAP (pull), mail access protocols.
DNS: distributed hierarchical database, iterative/recursive queries,
caching, resource records.
Video streaming: DASH, CDNs for scalability and low latency.
Socket programming: UDP (datagram) and TCP (stream) examples in
Python.
Self-review questions (exam preparation):
• How does a web cache reduce response time?
• What is the difference between a forward proxy and a reverse proxy?
• How does DNS caching improve performance and what problems can it
cause?
• Why is QUIC built on UDP instead of TCP?
• What happens when you type a URL into a browser? (steps: DNS, TCP,
HTTP, rendering)