Network Applications
The
raison d'être
of computer networks
Innovation happens in the application layer
– There is always a “killer application” – Remote login -> Email -> Web -> P2P
– Easy to add new protocols – only end-hosts need to install application program
Lower layers “fixed”
Applications Exist in End-points
Application Transport Network Link Network Link Application Transport Network Link API APIWhat is in an Application?
Application process App. Protocol BSD Socket API Application process App. Protocol BSD Socket API HTTP,SMTP,FTP, etc. OS Stack OS StackApplication Architectures
Client-Server Architecture
Applications: Web, Email, File Transfer
Server:
– provides a service, e.g., content
– always on, passive, fixed address/name – single point of failure
– server farms, load balancing, provide robustness and scalability
Client:
– service consumer
Peer-to-Peer Architecture
Applications: BitTorrent, Gnutella, Skype, etc.
No “infrastructure”
– Hosts/peers communicate directly and are “equal” – self-scalability
– often requires boot-strap server (entry into network)
Applications often form a logical
Overlay Network
physical network
Client/Server Architectures with
Overlay Aspects
DNS (Domain Name System)
– Hierarchical network of DNS servers
Akamai
– Content Delivery Network (CDN) for Web content
– Clever use of DNS to redirect your request to nearest server
– MTAs communicate via SMTP to deliver emails
Routing Protocols (RIP, OSPF)
– Routers communicate to exchange path information
Where to Draw the Line
No strict definition of peer-to-peer and overlay
“General” definition
– p2p = many-to-many (client/server = many-to-one)
– Includes distributed client/server (infrastructure in p2p mode)
“Pure/strict” definition
– No infrastructure – Entirely user driven
– Often associated with specific applications (e.g, KaZaa, Gnutella, BitTorrent, Skype)
Internet Traffic Trends
Application Service
Requirements
Bandwidth elastic elastic elastic audio: 5Kb-1Mb video:10Kb-5Mb same as above few Kbps up elastic Time Sensitive no no no yes, 100’s msec yes, few secs yes, 100’s msec yes and no Application file transfer e-mail web documents real-time audio/video stored audio/video interactive games financial apps Data loss no loss no loss no loss loss-tolerant loss-tolerant loss-tolerant no lossTransport Services Available to
Applications
TCP (Transport Control Protocol):
– full duplex byte stream connection
– reliable data transfer (loss-free, in order delivery) – congestion control
UDP (User Datagram Protocol):
– lightweight, connectionless datagram delivery service – unreliable (losses, out-of-order delivery)
– no congestion control
DCCP (Datagram Congestion Control Protocol):
– a mix between TCP and UDP
Addressing Applications
In packet switched networks all packets carry the
end-host address of the destination
– e.g., IP address in the Internet Protocol
But, once at the destination, how does the host
know which application the packet is for?
– The transport protocol specifies a 16-bit port number – A port maps to a process on the host
– The task of mapping the incoming packets to specific applications is called demultiplexing
p1 p2 p3
Network stack p1 p2 p3
Network stack
Port Numbers
Port numbers assigned by IANA/ICANN
Well-known port numbers (0-1023)
– 80 = HTTP, 21 = FTP, 25 = SMTP
– Restricted access in OS
Registered port numbers (1024-49151)
– Application ports that can be registered by e.g., companies
– 1214 = KaZaa, 26000 = Quake
Dynamic port numbers (49152-65535)
Writing Applications: What is a
socket?
Operating system handle for identifying the
end-points of communication
Berkeley sockets (BSD)
de facto
standard
To an application process a socket is just a number
Internally (in the OS), a socket is a “struct”:
– Local IP and port number – Remote IP and port number – State
sock = socket(PF_INET, SOCK_STREAM, 0); bind(sock, &sock_addr, addr_length);
The World Wide Web (1990s)
Four main components
– Server (e.g., Apache)
– Client (Firefox, IE, Safari)
– Application protocol (HTTP=stateless protocol) – Objects/data (HTML document, picture)
Persistent and non-persistent connections
Parallel transfers
Cookies
– state on clients
HyperText Transfer Protocol
<html lang="en"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <link rel="SHORTCUT ICON" href="/favicon.ico">
<title>UU/Department of Information Technology</title>
<link rel="stylesheet" type="text/css" href="/css/it-style.css"> <!-- Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9a8) Gecko/2007100619 GranParadiso/ 3.0a8 -->
<link rel="author" href="/katalog/search.php?name=Lotta%20Lundell&exact=yes"> <link rel="schema.DC" href="http://purl.org/dc/elements/1.1/">
<meta name="DC.title" content="Department of Information Technology, Uppsala University"> …
</head>
<body class='rededge' >
<table style='height:100%;overflow:visible;' cellspacing
GET / HTTP/1.1 Host: www.it.uu.se Connection: close User-agent: Mozilla/4.0 Accept-language: sv HTTP/1.1 200 OK Connection: close
Date: Mon, 03 Nov 2008 12:00:01 GMT Server: Apache/1.3.0 (Unix)
Last-Modified: Sun, 2 Nov 2008 15.34:23 GMT Content-Length: 8736
File Transfer Protocol - FTP
“Killer application” of the 80ies
Separate channels for control traffic and data traffic
– Commands do not have to wait for data (sent out-of-band)
Authentication
Server keeps state
– e.g., client's current directory
File system FTP client
FTP
FTP Server
FTP
TCP data connection (port 20) TCP control connection (port 21)
Asynchronous communication service
One of the first applications of the Internet
• Remains one of the most important applications to this day
Components:
• Mail User Agents (MUAs):
• Outlook, Thunderbird
• Mail Transfer Agents (MTAs)
• Sendmail, Postfix, Microsoft Exchange server
• Simple Mail Transfer Protocol (SMTP)
• Push protocol
• 7-bit ASCII encoding (headers and body)
E-mail client
Sending and Receiving Email
E-mail client SMTP server SMTP server POP server SMTP server SMTP SMTP SMTP SMTP POP POP
SMTP Interaction
S: 220 hamburger.edu C: HELO crepes.fr
S: 250 Hello crepes.fr, pleased to meet you C: MAIL FROM: <[email protected]>
S: 250 [email protected]... Sender ok C: RCPT TO: <[email protected]>
S: 250 [email protected] ... 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
SMTP vs. HTTP
HTTP is a pull protocol
SMTP is a push protocol
Both have ASCII command/response interaction
HTTP encapsulates each object in its own response
message
SMTP sends multiple objects in multipart message
SMTP uses persistent connections (optional for
24
Mail message format
SMTP: protocol for exchanging email msgs
RFC 822: standard for text message format:
Header lines, e.g.,
– To: – From: – Subject:
different from SMTP commands!
Body
– the “message”, ASCII characters only
header
body
blank line
25
Message format: multimedia extensions
MIME: multimedia mail extension, RFC 2045, 2056additional lines in msg header declare MIME content type
From: [email protected] To: [email protected]
Subject: Picture of yummy crepe. MIME-Version: 1.0
Content-Transfer-Encoding: base64 Content-Type: image/jpeg
base64 encoded data ... ... ...base64 encoded data
multimedia data type, subtype, parameter declaration method used to encode data MIME version encoded data
26
POP3 and IMAP
POP3
“Download and delete” mode.
Cannot re-read e-mail if one changes client
“Download-and-keep”: copies of messages on different clients
POP3 is stateless across sessions
IMAP
Keep all messages in one place: the server
Allows user to organize messages in folders
IMAP keeps user state across sessions:
– names of folders and mappings between
message IDs and folder name
Domain Name System (DNS)
Problem:
It is difficult to remember addresses based
on numbers
Name hosts with human readable names
– e.g. hamberg.it.uu.se
Translate between address and name
– Initially done by editing /etc/hosts file
• Not really scalable
– DNS developed in the late 80ies
28
Root DNS Servers
com DNS servers org DNS servers edu DNS servers poly.edu DNS servers umass.edu DNS servers yahoo.com DNS servers amazon.com DNS servers pbs.org DNS servers
Distributed, Hierarchical Database
Client wants IP for www.amazon.com; 1st approx:
client queries a root server to find com DNS server
client queries com DNS server to get amazon.com DNS server
client queries amazon.com DNS server to get IP address for www.amazon.com
2: Application Layer 29 requesting host cis.poly.edu gaia.cs.umass.edu root DNS server local DNS server dns.poly.edu 1 2 3 4 5 6 authoritative DNS server dns.cs.umass.edu 7 8 TLD DNS server
DNS name
resolution example
Host at cis.poly.edu wants IP address for
gaia.cs.umass.edu
iterated query:
contacted server replies with name of server to contact
“I don’t know this name, but ask this server”
2: Application Layer 30
DNS: Root name servers
contacted by local name server that can not resolve name root name server:
– contacts authoritative name server if name mapping not known – gets mapping
– returns mapping to local name server
13 root name
servers worldwide
b USC-ISI Marina del Rey, CA l ICANN Los Angeles, CA e NASA Mt View, CA
f Internet Software C. Palo Alto, CA (and 36 other locations)
i Autonomica, Stockholm (plus 28 other locations) k RIPE London (also 16 other locations)
m WIDE Tokyo (also Seoul, Paris, SF)
a Verisign, Dulles, VA
c Cogent, Herndon, VA (also LA) d U Maryland College Park, MD g US DoD Vienna, VA
h ARL Aberdeen, MD