2. Application Layer
Total Page:16
File Type:pdf, Size:1020Kb
2. Application Layer Computer Networking: A Top Down Approach th 6 edition Jim Kurose, Keith Ross Addison-Wesley March 2012 All material copyright 1996-2012 J.F Kurose and K.W. Ross, All Rights Reserved Application Layer 2-1 2. Application layer: Outline 2.1 principles of network 2.6 P2P applications applications 2.7 socket programming 2.2 Web and HTTP with UDP and TCP 2.3 FTP 2.4 electronic mail § SMTP, POP3, IMAP 2.5 DNS Application Layer 2-2 2. Application layer: Goals our goals: v learn about protocols by v conceptual, examining popular implementation aspects application-level of network application protocols protocols § HTTP § transport-layer § FTP service models § SMTP / POP3 / IMAP § client-server § DNS paradigm v creating network § peer-to-peer applications paradigm § socket API Application Layer 2-3 Some network apps v e-mail v voice over IP (e.g., Skype) v web v real-time video v text messaging conferencing v remote login v social networking v P2P file sharing v search v multi-user network games v … v streaming stored video v … (YouTube, Hulu, Netflix) Application Layer 2-4 Creating a network app application transport network data link write programs that: physical v run on (different) end systems v communicate over network v e.g., web server software communicates with browser software no need to write software for application transport network-core devices network data link application physical transport v network-core devices do not network data link run user applications physical v applications on end systems allows for rapid app development, propagation Application Layer 2-5 Application architectures possible structure of applications: v client-server v peer-to-peer (P2P) Application Layer 2-6 Client-server architecture server: v always-on host v permanent IP address v data centers for scaling clients: v initiate communication to client/server server v intermittently connected v may have dynamic IP addresses v do not communicate directly with each other Application Layer 2-7 P2P architecture v no always-on server peer-peer v peers request service from other peers, provide service in return to other peers § self scalability – new peers bring new service capacity, as well as new service demands v peers are intermittently connected and change IP addresses § complex management Application Layer 2-8 Processes communicating process: program running clients, servers within a host client process: process that v within same host, two initiates communication processes communicate server process: process that using inter-process communication (defined by waits to be contacted OS) v processes in different hosts communicate by exchanging v aside: even P2P applications messages have client processes & server processes Application Layer 2-9 Sockets v process sends/receives messages to/from its socket v socket analogous to a dropbox at door § sending process shoves message into dropbox § sending process relies on transport to deliver message to dropbox at receiving process application application socket controlled by process process app developer transport transport network network controlled by OS link Internet link physical physical Application Layer 2-10 Addressing processes v to receive messages, v identifier includes both IP process must have identifier address and port numbers v host device has unique 32- associated with process on bit IP address host. v Q: does IP address of host v example port numbers: on which process runs § HTTP server: 80 suffice for identifying the § mail server: 25 process? v to send HTTP message to § A: no, many processes www.cs.umass.edu web can be running on same server: host § IP address: 128.119.240.84 § port number: 80 v more shortly… Application Layer 2-11 App-layer protocol defines v types of messages open protocols: exchanged, v defined in RFCs § e.g., request, response v allows for interoperability v message syntax: v e.g., HTTP, SMTP § what fields in messages proprietary protocols: & how fields are v e.g., Skype delineated v message semantics § meaning of information in fields v rules for when and how processes send & respond to messages Application Layer 2-12 What transport service does an app need? data integrity throughput v some apps (e.g., file transfer, v some apps (e.g., web transactions) require multimedia) require 100% reliable data transfer minimum amount of throughput to be v other apps (e.g., audio) can “ ” tolerate some loss effective v other apps (“elastic apps”) timing make use of whatever throughput they get v some apps (e.g., Internet telephony, interactive security games) require low delay to be “effective” v encryption, data integrity, … Application Layer 2-13 Transport service requirements: common apps application data loss throughput time sensitive file transfer no loss elastic no e-mail no loss elastic no Web documents no loss elastic no real-time audio/video loss-tolerant audio: 5kbps-1Mbps yes, 100’s video:10kbps-5Mbps msec stored audio/video loss-tolerant same as above interactive games loss-tolerant few kbps up yes, few secs text messaging no loss elastic yes and no, 100s msec Application Layer 2-14 Common Internet transport services TCP service: UDP service: v reliable transport between v unreliable data transfer sending and receiving between sending and process receiving process v flow control: sender won’t overwhelm receiver v does not provide: reliability, flow control, v congestion control: throttle sender when network congestion control, overloaded timing, throughput guarantee, security, v does not provide: timing, minimum throughput orconnection setup, guarantee, security v connection-oriented: setup Q: why bother? Why is required between client and there a UDP? server processes Application Layer 2-15 Internet apps: application, transport protocols application underlying application layer protocol transport protocol e-mail SMTP [RFC 2821] TCP remote terminal access Telnet [RFC 854] TCP Web HTTP [RFC 2616] TCP file transfer FTP [RFC 959] TCP streaming multimedia HTTP (e.g., YouTube), TCP or UDP RTP [RFC 1889] Internet telephony SIP, RTP, proprietary (e.g., Skype) TCP or UDP Q: Why might skype use TCP? Application Layer 2-16 Securing TCP TCP & UDP SSL is at app layer v no encryption v Apps use SSL libraries, v cleartext passwds sent which “talk” to TCP into socket traverse SSL socket API Internet in cleartext v cleartext passwds sent SSL into socket encrypted v provides encrypted before transmission TCP connection v See Chapter 7 v data integrity v end-point authentication Application Layer 2-17 Q1: TCP vs. UDP v Which of the following is true? A. FTP uses UDP B. HTTP uses UDP C. UDP ensures in-order delivery but not reliability D. HTTP uses TCP Application Layer 2-18 Q2 Endpoint process identifier v A network application process is identified uniquely by which of the following? A. IP address B. IP address, port C. IP address, port, MAC address D. domain name Application Layer 2-19 Q3 Transport v Pick the true statement A. TCP provides reliability and guarantees a minimum bandwidth. B. TCP provides reliability while UDP provides bandwidth guarantees. C. TCP provides reliability while UDP does not. D. Neither TCP nor UDP provide reliability. Application Layer 2-20 Q4 HTTP v Persistent HTTP fetches multiple web objects over a single TCP connection while non- persistent HTTP uses a separate TCP connection for each object. True/false? A. True B. False Application Layer 2-21 2. Application layer: Outline 2.1 principles of network 2.6 P2P applications applications 2.7 socket programming 2.2 Web and HTTP with UDP and TCP 2.3 FTP 2.4 electronic mail § SMTP, POP3, IMAP 2.5 DNS Application Layer 2-22 Web and HTTP First, a review… v web page consists of objects v object can be HTML file, JPEG image, Java applet, audio file,… v web page consists of base HTML-file which includes several referenced objects v each object is addressable by a URL, e.g., www.someschool.edu/someDept/pic.gif host name path name Application Layer 2-23 HTTP overview HTTP: hypertext transfer protocol v Web’s application layer protocol PC running Firefox browser v client/server model § client: browser that requests, receives, (using HTTP protocol) server and “displays” Web running objects Apache Web § server: Web server server sends (using HTTP protocol) objects in iphone running response to requests Safari browser Application Layer 2-24 HTTP overview (continued) uses TCP: HTTP is “stateless” v client initiates TCP v server maintains no connection (creates socket) information about to server, port 80 past client requests § cookies an exception v server accepts TCP connection from client aside protocols that maintain v HTTP messages “state” are complex! (application-layer protocol v past history (state) must be messages) exchanged maintained between browser (HTTP v if server/client crashes, their client) and Web server views of “state” may be (HTTP server) inconsistent, must be v TCP connection closed reconciled Application Layer 2-25 HTTP connections non-persistent HTTP persistent HTTP v at most one object v multiple objects can sent over TCP be sent over single connection TCP connection § connection then between client, server closed v downloading multiple objects required multiple connections Application Layer 2-26 Non-persistent HTTP suppose user enters URL: (contains text, www.someSchool.edu/someDepartment/home.index references to 10 jpeg images) 1a. HTTP client initiates TCP connection to HTTP server (process) at 1b. HTTP server at host www.someSchool.edu on port www.someSchool.edu waiting 80 for TCP connection at port 80. “accepts” connection, notifying 2. HTTP client sends HTTP request client message (containing URL) into TCP connection socket. 3. HTTP server receives request Message indicates that client message, forms response wants object someDepartment/ message containing requested home.index object, and sends message into its socket time Application Layer 2-27 Non-persistent HTTP (cont.) 4.