Application Layer
Application Layer Overview
Principles of Network Applications
Explore conceptual and implementation aspects of application-layer protocols.
Study transport-layer service models.
Understand client-server and peer-to-peer paradigms.
Learn about popular application-layer protocols and their infrastructure including HTTP, SMTP, IMAP, DNS, and video streaming systems.
Programming network applications using socket API.
Applications of Networking
Examples of Network Applications:
Social media
Web browsing
Text messaging
E-mail
Multi-user network games
Streaming video services (e.g., YouTube, Hulu, Netflix)
Peer-to-peer (P2P) file sharing
Voice over IP (VoIP)
Real-time video conferencing (e.g., Zoom)
Internet search
Remote login
Network Applications and Architecture
Applications run on different end systems and communicate over networks (e.g., web server software and browser software).
Network-core devices do not run user applications; focus is on applications on end systems for rapid development and propagation.
Client-Server Paradigm
Server Characteristics:
Always-on host
Permanent IP address
Located often in data centers for scalability.
Client Characteristics:
Intermittently connected
May have dynamic IP addresses
Do not communicate directly with each other.
Examples include protocols like HTTP, IMAP, and FTP.
Peer-to-Peer Architecture
No always-on server; any arbitrary end system can communicate directly.
Peers request and provide services to other peers, creating self-scalability.
Peers are intermittently connected and may change IP addresses.
Example: P2P file sharing (e.g., BitTorrent).
Processes and Communication
Process: A program running within a host.
Within the same host, two processes communicate using inter-process communication.
In different hosts, processes communicate by exchanging messages.
P2P applications involve both client and server processes.
Types of Processes:
Client process: Initiates communication.
Server process: Waits to be contacted.
Sockets
A socket is analogous to a door through which processes send and receive messages.
Sending processes rely on transport infrastructure to deliver messages to the receiving process's socket.
There are two sockets involved in a communication: one on each side.
Addressing Processes
To receive messages, a process must have an identifier.
A host device has a unique 32-bit IP address. However, this is insufficient for identifying a process alone.
Process identification utilizes both the IP address and associated port numbers. Examples include:
HTTP server: Port 80
Mail server: Port 25
For example, sending a message to the HTTP server gaia.cs.umass.edu using:
IP address: 128.119.245.12
Port number: 80
Application Layer Protocols
Defines types of messages exchanged and rules for message syntax, semantics, and application-layer interactions.
Best example of open protocols: HTTP and SMTP (defined in RFCs).
Transport Service Requirements
Data Integrity: Some applications require reliable data transfer (e.g., file transfers) while others can tolerate some loss (e.g., audio).
Timing: Low delay is crucial for interactive applications (e.g., telephony, games).
Throughput: Minimum throughput is required by some applications, whereas others are elastic and adapt to available throughput.
Security: Critical for applications that handle sensitive data (requires encryption and data integrity).
Internet Transport Protocols
TCP Services:
Reliable transport between sending and receiving processes.
Flow control to avoid overwhelming the receiver and congestion control to manage network overload.
Connection-oriented requiring setup between client and server processes.
UDP Services:
Unreliable data transfer, no guarantees of delivery, flow control, or congestion control. Used where low latency is prioritized.
Example Applications and Protocols
Common Applications:
File transfer/download (TCP required)
E-mail (SMTP)
Web documents (HTTP)
Real-time audio/video (SIP, RTP)
Interactive games (UDP or TCP)
Security Implementations for TCP
TCP and UDP lack inherent encryption, leading to cleartext passwords being sent over sockets.
Transport Layer Security (TLS) provides encrypted connections and data integrity through libraries in the application layer.
Web and HTTP
Web Page Structure: Consists of objects, which can be stored on different web servers (e.g., HTML files, images).
HTTP Overview:
The web’s application-layer protocol, utilizing TCP for establishing connections and exchanging messages.
HTTP maintains a stateless nature, meaning no information is retained about past transactions, which simplifies interaction but complicates state management.
HTTP Connection Types
Non-Persistent HTTP:
A TCP connection is opened for each object, requiring multiple connections for multiple objects.
Persistent HTTP (HTTP/1.1):
One TCP connection can remain open for multiple objects, significantly reducing round-trip times (RTT).
Different Types of HTTP Messages
HTTP request message contains:
Request line
Header lines (e.g., host, user-agent)
Body (if any)
Common methods include GET, POST, HEAD, and PUT:
GET: Requesting data, including parameters in the URL.
POST: Sending data as part of the request body.
HEAD: Requesting headers only.
PUT: Uploading new files.
HTTP Response Messages
Response formats include:
Status line (e.g., HTTP/1.1 200 OK)
Header lines (e.g., content type, server information)
Status Codes in HTTP
Various 3-digit codes indicate the outcome of an HTTP request, such as:
200 OK: Successful request
301 Moved Permanently: Resource relocated
400 Bad Request: Syntax somewhat invalid
404 Not Found: Resource not available
Cookies and HTTP
HTTP is a stateless protocol but cookies maintain state between requests. They include a header line in responses and are utilized by user browsers to make requests with identifying values.
Uses include authorization, shopping carts, and session management.
DNS: Domain Name System
Maps human-readable domain names to IP addresses through a distributed hierarchy of servers.
Essential functions include hostname to IP address translation and load distribution.
Name Resolution:
Can use iterative queries (client receives a response telling which server to ask next) or recursive queries (server answers right away or refers the client).
Video Streaming and CDNs
Video streaming is a major consumer of Internet bandwidth, presenting challenges in terms of scalability and network congestion.
Content Distribution Networks (CDNs) help mitigate congestion by distributing loads and serving multiple copies of content geographically close to users.
Socket Programming Overview
Important for building client/server applications.
Socket Types:
UDP (unreliable datagram)
TCP (reliable, byte-stream oriented)
Example Python Socket Applications
Examples demonstrate the creation of UDP and TCP clients and servers, handling the establishment of connections, sending messages, and dealing with exceptions and timeouts in socket programming.
Summary of Chapter 2
The application layer's concepts and protocols were covered, highlighting important aspects like the client-server and P2P models, transport service requirements, socket programming, and real-world applications like HTTP, SMTP, and DNS.