Communicating Applications
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 Will we ever have IPv6, multicast, QoS?
Applications Exist in End-points Application API Transport Network Link Network Link Application API Transport Network Link
What is in an Application? HTTP,SMTP,FTP, etc. Application process App. Protocol BSD Socket API Application process App. Protocol BSD Socket API OS Stack OS Stack
Application Architectures Client-Server Peer-to-Peer
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 initiates service requests, can come and go
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 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 Email MTAs communicate via SMTP to deliver emails Routing Protocols (RIP, OSPF) Routers communicate to exchange path information not really client/server
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 Source: CacheLogic
Application Service Requirements Application Data loss Bandwidth Time Sensitive file transfer e-mail web documents real-time audio/video stored audio/video interactive games financial apps no loss no loss no loss loss-tolerant loss-tolerant loss-tolerant no loss elastic elastic elastic audio: 5Kb-1Mb video:10kb-5mb same as above few Kbps up elastic no no no yes, 100 s msec yes, few secs yes, 100 s msec yes and no
Transport 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 No security!
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 demultiplexing p1 p2 p3 Network stack p1 p2 p3 Network stack multiplexing
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) Operating system dynamically allocates client source port
Writing Applications: What is a socket? Operating system handle for identifying the endpoints 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);
Application Layer Protocols
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 Web caching
HyperText Transfer Protocol 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 Content-Type: text/html <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
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 FTP client FTP TCP control connection (port 21) FTP Server FTP File system TCP data connection (port 20) File system
Email 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) Mail access protocols: POP/IMAP
Sending and Receiving Email E-mail client SMTP SMTP server SMTP SMTP SMTP server E-mail client POP POP server POP SMTP server SMTP
SMTP Interaction S: 220 hamburger.edu C: HELO crepes.fr S: 250 Hello crepes.fr, pleased to meet you C: MAIL FROM: <alice@crepes.fr> S: 250 alice@crepes.fr... Sender ok C: RCPT TO: <bob@hamburger.edu> S: 250 bob@hamburger.edu... 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 hamburger.edu closing connection
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 HTTP)
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 24
Message format: multimedia extensions MIME: multimedia mail extension, RFC 2045, 2056 additional lines in msg header declare MIME content type MIME version method used to encode data multimedia data type, subtype, parameter declaration encoded data From: alice@crepes.fr To: bob@hamburger.edu Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Type: image/jpeg base64 encoded data.........base64 encoded data 25
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 26
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 Distributed hierarchical directory service
Distributed, Hierarchical Database Root DNS Servers com DNS servers org DNS servers edu DNS servers yahoo.com DNS servers amazon.com DNS servers pbs.org DNS servers poly.edu umass.edu DNS servers DNS servers Client wants IP for www.amazon.com; 1 st 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 28
DNS name resolution example root DNS server Host at cis.poly.edu wants IP address for gaia.cs.umass.edu 2 3 4 5 TLD DNS server iterated query: contacted server replies with name of server to contact I don t know this name, but ask this server local DNS server dns.poly.edu 1 8 requesting host cis.poly.edu 7 6 authoritative DNS server dns.cs.umass.edu gaia.cs.umass.edu 2: Application Layer 29
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 e NASA Mt View, CA f Internet Software C. Palo Alto, CA (and 36 other locations) 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 j Verisign, ( 21 locations) k RIPE London (also 16 other locations) i Autonomica, Stockholm (plus 28 other locations) m WIDE Tokyo (also Seoul, Paris, SF) b USC-ISI Marina del Rey, CA l ICANN Los Angeles, CA 13 root name servers worldwide 2: Application Layer 30