application layer Flashcards
application layer messages
often split over multiple packets or may be aggregated in a packet
application communication needs
vary widely on the app
must build on Transport services
examples( Web, DNS, Skype)
OSI session/presentation layers
part of app layer
presentation: converts diffrent representations
session: manages task dialogs
session concept
a session is a series of related network interactions in support of an application task
often informal, not explicit
examples:
- web page fetches multiple resources
- zoom call involves audio, video, chat
presentation concept
apps need to identify the type of content, and encode it for transfer
- presentation functions
- examples:
Media (MIME) types, e.g., image/jpeg, identify the type of content
transfer encodings, e.g., gzip, identify the encoding of the content
application headers are often simple and readable versus packed for efficiency
DNS
Domain Name System
machines on the internet identified by their IP addresses
DNS translates human readable names to IP addresses
DNS name space
hierarchical structure
- top level domains controlled by Internet Corporation for Assigned Names and Numbers (ICANN)
- organisations can request second-level domains from registrars (com-cisco-eng…)
- countries have their own second-level domains
- .edu and .gov are generic domains, but mostly used by organisations in the US
- if you own a domain, you can specify arbitrary subdomains
name servers
to translate a domain name to an IP address, you ask a name server
location of name servers
- hosts learn about the location of name servers via DHCP
- the operating system keeps track of name servers and dynamically selects which one to use
DHCP
Dynamic Host Configuration Protocol
- MAC addresses are built into NICs, but network addresses are not
- used to configure other settings such as: DNS name servers, addresses of default gateway, time servers, etc.
recursive and iterative queries
local name server-recursive
others-iterative
DNS Resource Record (RR) Types
- IPv4 address (record type A)
- IPv6 address (record type AAAA)
- domain that accepts email (record type MX)
- name server for this domain (record type NS)
- alias to canonical name (record type CNAME)
- …
Content Delivery Networks
a type of caching to increase system capability
front end forwards requests and distributed load
DNS can be used for load balancing
Metcalfe’s Law
- the value of a network is proportional to the square of the number of users
- (i.e., value is proportional to the number of possible connections)
- as networks get larger, there is more value on joining them, making them larger
email message formats
envelope (used to get the message to the correct recipient)
header
body
helpful email headers
message-id, in-reply-to, reply-to
email protocols
POP3 or IMAP for user interaction with mailbox
users and Message Transfer Message Agents use SMPT to send an email from src do dst
How does email work?
mail submission uses SMPT+Extensions(e.g. AUTH)
message transfer between mail servers uses SMTP
final delivery uses IMAP/POP3 or a propriety protocol
IMAP
Internet message access protocol
sends commands to mail server to manipulate mailboxes
uses mostly plain text (security through TLS)
replaced POP3
common IMAP commands
LOGIN: login into server
FETCH: fetch messages from a folder
CREATE/DELETE: create or delete a folder
EXPUNGE: remove messages marked for deletion
SMTP
Simple mail transfer protocol
uses ASCII
you can use TELNET to talk to a mail server
basic SMTP does not support binary data
basic SMPT does not include authentication
many extensions exist to address these issues
MIME
Multipurpose Internet Mail extensions
used to create messages with multiple data types (e.g., an email with attachment)
developed for email but used broader
if MIME-Version in header → check Content-Type; else → plain text
MIME content-types
text: text/plain, text/html
images: image/jpeg, image/gif
video: video/mp4, video/mpeg
multipart: multipart/mixed, multipart/alternative
MIME headers
- MIME-Version
- Content-Description
- Content-Id
- Content-Transfer-Encoding
- Content-Type
sending binary data via ASCII
only SMTP
base64 encoding converts binary data into ASCII
when MIME was introduced, servers were not expecting non-ASCII data
modern SMTP supports binary data
base64 encoding
- used to convert binary data to and from ASCII
- alphabet: [A-Za-z0-9+/]
- overhead: ??
- 6 bits are translated into 1 character
- = sign indicates 2 padded bits
HTTP Request/Response
- HTML documents hosted by servers
- clients send request for document
- from server
HTTP Protocol
originally a simple text-based protocol; many options added over time
HTTP Request Methods: GET, POST, PUT, HEAD…
HTTP sequential requests
connection setup each time
HTTP persistent connection
increases performance by reducing connection setup overhead
allows browsers to issue multiple requests over the same TCP connection
increase performance over the same TCP connection
increase performance by reducing connection setup overhead
Head of Line Blocking (HOL)
each request has to wait for the previous one to complete
HTTP1.1 : pipelines requests
HTTP/2: out-of-order responses
HTTP1.1 pipelined requests
- reduces HOL
- increase performance by pipelining request (hiding latency)
- performance problem: responses need to arrive in same order as requests
HTTP/2
- binary instead of plaintext
- easier for machines to parse
- more difficult for humans to read
- multiplexed streams over a single TCP connection
- supports out-of-order responses
- server push allows the server to send resources before the client asks for it explicitly
HTTP/3
= (HTTP+QUIC)
- http3 uses QUIC protocol
- QUIC orders data per stream
- each HTTP request can use a separate stream; within a stream, data is delivered in order; across streams no such guarantee is made
- QUIC performs multiplexing, uses UDP
- UDP does not enforce in-order delivery
Web sockets
a socket-like interface on the application layer
full-duplex connection between server and client
→ the application layer can contain protocols
use case: increasingly complex ‘apps on the Web that need to send data continuously
stacking
application layer can continue stacking protocols
protocols may provide services the ones below/above do not
new narrow waist
HTTP
advantages of using HTTP over TCP directly
provides a set of methods
provides security
provides naming
multimedia applications
streaming video requires compression
without compression, only possible over wired fibre-optic channels
compression reduced bandwidth requirement by an order of magnitude
digital audio compression
large compression rates > x10
audio typically compressed before sending
lossy compression achieves higher compression rates than lossless compression, but loses data
lossy encoders based on how humans perceive sound
digital image compression
- changes RGB to Y Cb Cr
- Y is luminance
- Cb Cr are chrominances
- eyes are less sensitive to chrominance than to luminance
- JPEG reduces size of Cb and Cr
- total compression rate x2
digital video compression
large compression rates > x50
MPEG compresses over a sequence of frames, further using motion tracking to remove temporal redundancy
types of frames in compression
I (Intra-coded) frames are self-contained
P (Predictive) looks for comparable macro blocks in previous frames
-How long to search is up to the implementation
B (Bidirectional) frames may base prediction on previous frames and future frames
run-length encoding
part of JPEG compression
lossless compression technique
Huffman encoding
- prefix code: no code word is prefix of other code word
- less than half of the original size
- part of JPEG compression
-from a tree by select two smallest nodes, and combining them into a new node, until only the root is left
challenges in streaming stored media
How to handle transmission errors?
- use reliable transport (e.g., TCP) → increase jitter significantly
- use forward error correction (error correction in the application layer) → increase jitter, decoding complexity, and overhead
- interleave media → slightly increase jitter and decoding complexity
Masking errors by interleaving media
- low-water mark prevents stalls in playback
- high-water mark gives time to prevent running out of buffer space
challenges in streaming live media
stored +
can’t stream faster than live rate to get ahead → usually need larger buffer to absorb jitter
- often have many users viewing at the same time
→ UDP with multicast greatly improves efficiency; it is rarely available, so many TCP connections are used
challenges in streaming interactive media
real-time conferencing has two or more connected live media streams, e.g., voice over IP, Skype video call
requires low jitter and low latency
- benefits from network support (Quality of Service)
- large bandwidth (no congestion)
difficult to provide across long distances/multiple networks