3rd edition chapter 2 eecs user home pages第三版第2個(gè)用戶(hù)的主頁(yè)_第1頁(yè)
3rd edition chapter 2 eecs user home pages第三版第2個(gè)用戶(hù)的主頁(yè)_第2頁(yè)
3rd edition chapter 2 eecs user home pages第三版第2個(gè)用戶(hù)的主頁(yè)_第3頁(yè)
3rd edition chapter 2 eecs user home pages第三版第2個(gè)用戶(hù)的主頁(yè)_第4頁(yè)
3rd edition chapter 2 eecs user home pages第三版第2個(gè)用戶(hù)的主頁(yè)_第5頁(yè)
已閱讀5頁(yè),還剩130頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、Chapter 2Application LayerComputer Networking: A Top Down Approach, 5th edition. Jim Kurose, Keith RossAddison-Wesley, April 2021. A note on the use of these ppt slides:Were making these slides freely available to all (faculty, students, readers). Theyre in PowerPoint form so you can add, modify, an

2、d delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: If you use these slides (e.g., in a class) in substantially unaltered form, that you mention their source (after all, wed like

3、people to use our book!) If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material.Thanks and enjoy! JFK/KWRAll material copyright 1996-2021J.F Kurose and K.W. Ross, All

4、 Rights ReservedApplication 2-1Chapter 2: Application layer2.1 Principles of network applications2.2 Web and HTTP2.3 FTP 2.4 Electronic MailSMTP, POP3, IMAP2.5 DNS2.6 P2P applications2.7 Socket programming with TCP2.8 Socket programming with UDPApplication 2-2Chapter 2: Application LayerOur goals: c

5、onceptual, implementation aspects of network application protocolstransport-layer service modelsclient-server paradigmpeer-to-peer paradigmlearn about protocols by examining popular application-level protocolsHTTPFTPSMTP / POP3 / IMAPDNSprogramming network applicationssocket APIApplication 2-3Some n

6、etwork appse-mailwebinstant messagingremote loginP2P file sharingmulti-user network gamesstreaming stored video (YouTube)voice over IPreal-time video conferencingcloud computing Application 2-4Creating a network appwrite programs thatrun on (different) end systemscommunicate over networke.g., web se

7、rver software communicates with browser softwareNo need to write software for network-core devicesnetwork-core devices do not run user applications applications on end systems allows for rapid app development, propagationapplicationtransportnetworkdata linkphysicalapplicationtransportnetworkdata lin

8、kphysicalapplicationtransportnetworkdata linkphysicalApplication 2-5Chapter 2: Application layer2.1 Principles of network applications2.2 Web and HTTP2.3 FTP 2.4 Electronic MailSMTP, POP3, IMAP2.5 DNS2.6 P2P applications2.7 Socket programming with TCP2.8 Socket programming with UDPApplication 2-6App

9、lication architecturesclient-serverpeer-to-peer (P2P)hybrid of client-server and P2PApplication 2-7Client-server architectureserver: always-on hostpermanent IP addressserver farms for scalingclients:communicate with servermay be intermittently connectedmay have dynamic IP addressesdo not communicate

10、 directly with each otherclient/serverApplication 2-8Pure P2P architectureno always-on serverarbitrary end systems directly communicatepeers are intermittently connected and change IP addresseshighly scalable but difficult to managepeer-peerApplication 2-9Hybrid of client-server and P2PSkypevoice-ov

11、er-IP P2P applicationcentralized server: finding address of remote party: client-client connection: direct (not through server) Instant messagingchatting between two users is P2Pcentralized service: client presence detection/locationuser registers its IP address with central server when it comes onl

12、ineuser contacts central server to find IP addresses of buddiesApplication 2-10Processes communicatingprocess: program running within a host.within same host, two processes communicate using inter-process communication (defined by OS).processes in different hosts communicate by exchanging messagescl

13、ient process: process that initiates communicationserver process: process that waits to be contactedaside: applications with P2P architectures have client processes & server processesApplication 2-11Socketsprocess sends/receives messages to/from its socketsocket analogous to doorsending process shov

14、es message out doorsending process relies on transport infrastructure on other side of door which brings message to socket at receiving processprocessTCP withbuffers,variablessockethost orserverprocessTCP withbuffers,variablessockethost orserverInternetcontrolledby OScontrolled byapp developerAPI: (

15、1) choice of transport protocol; (2) ability to fix a few parameters (lots more on this later) Application 2-12Addressing processesto receive messages, process must have identifierhost device has unique 32-bit IP addressQ: does IP address of host on which process runs suffice for identifying the pro

16、cess?Application 2-13Addressing processesto receive messages, process must have identifierhost device has unique 32-bit IP addressQ: does IP address of host on which process runs suffice for identifying the process?A: No, many processes can be running on same hostidentifier includes both IP address

17、and port numbers associated with process on host.example port numbers:HTTP server: 80Mail server: 25to send HTTP message to web server:IP address: Port number: 80more shortlyApplication 2-14App-layer protocol definestypes of messages exchanged, e.g., request, response message syntax:what fields in m

18、essages & how fields are delineatedmessage semantics meaning of information in fieldsrules for when and how processes send & respond to messagespublic-domain protocols:defined in RFCsallows for interoperabilitye.g., HTTP, SMTPproprietary protocols:e.g., SkypeApplication 2-15What transport service do

19、es an app need?Data losssome apps (e.g., audio) can tolerate some lossother apps (e.g., file transfer, telnet) require 100% reliable data transfer Timingsome apps (e.g., Internet telephony, interactive games) require low delay to be “effectiveThroughputsome apps (e.g., multimedia) require minimum am

20、ount of throughput to be “effectiveother apps (“elastic apps) make use of whatever throughput they get Securityencryption, data integrity, Application 2-16Transport service requirements of common appsApplicationfile transfere-mailWeb documentsreal-time audio/videostored audio/videointeractive gamesi

21、nstant messagingData lossno lossno lossno lossloss-tolerantloss-tolerantloss-tolerantno lossThroughputelasticelasticelasticaudio: 5kbps-1Mbpsvideo:10kbps-5Mbpssame as above few kbps upelasticTime Sensitivenononoyes, 100s msecyes, few secsyes, 100s msecyes and noApplication 2-17Internet transport pro

22、tocols servicesTCP service:connection-oriented: setup required between client and server processesreliable transport between sending and receiving processflow control: sender wont overwhelm receiver congestion control: throttle sender when network overloadeddoes not provide: timing, minimum throughp

23、ut guarantees, securityUDP service:unreliable data transfer between sending and receiving processdoes not provide: connection setup, reliability, flow control, congestion control, timing, throughput guarantee, or security Q: why bother? Why is there a UDP?Application 2-18Internet apps: application,

24、transport protocolsApplicatione-mailremote terminal accessWeb file transferstreaming multimediaInternet telephonyApplicationlayer protocolSMTP RFC 2821Telnet RFC 854HTTP RFC 2616FTP RFC 959HTTP (e.g., YouTube), RTP RFC 1889SIP, RTP, proprietary(e.g., Skype)Underlyingtransport protocolTCPTCPTCPTCPTCP

25、 or UDPtypically UDPApplication 2-19Chapter 2: Application layer2.1 Principles of network applications app architecturesapp requirements2.2 Web and HTTP2.3 FTP2.4 Electronic MailSMTP, POP3, IMAP2.5 DNS2.6 P2P applications2.7 Socket programming with TCP2.8 Socket programming with UDPApplication 2-20W

26、eb and HTTPFirst, a reviewweb page consists of objectsobject can be HTML file, JPEG image, Java applet, audio file,web page consists of base HTML-file which includes several referenced objectseach object is addressable by a URLexample URL:/someDept/pic.gifhost namepath nameApplication 2-21HTTP overv

27、iewHTTP: hypertext transfer protocolWebs application layer protocolclient/server modelclient: browser that requests, receives, “displays Web objectsserver: Web server sends objects in response to requestsPC runningExplorerServer runningApache WebserverMac runningNavigatorHTTP requestHTTP requestHTTP

28、 responseHTTP responseApplication 2-22HTTP overview (continued)Uses TCP:client initiates TCP connection (creates socket) to server, port 80server accepts TCP connection from clientHTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server)

29、TCP connection closedHTTP is “statelessserver maintains no information about past client requestsprotocols that maintain “state are complex!past history (state) must be maintainedif server/client crashes, their views of “state may be inconsistent, must be reconciledasideApplication 2-23HTTP connecti

30、onsnon-persistent HTTPat most one object sent over TCP connection.persistent HTTPmultiple objects can be sent over single TCP connection between client, server.Application 2-24Nonpersistent HTTPsuppose user enters URL:1a. HTTP client initiates TCP connection to HTTP server (process) at someS on port

31、 802. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object someDepartment/home.index1b. HTTP server at host someS waiting for TCP connection at port 80. “accepts connection, notifying client3. HTTP server receives request mess

32、age, forms response message containing requested object, and sends message into its sockettime(contains text, references to 10 jpeg images)Application 2-25Nonpersistent HTTP (cont.)5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jp

33、eg objects6. Steps 1-5 repeated for each of 10 jpeg objects4. HTTP server closes TCP connection. timeApplication 2-26Non-Persistent HTTP: Response timedefinition of RTT: time for a small packet to travel from client to server and back.response time:one RTT to initiate TCP connectionone RTT for HTTP

34、request and first few bytes of HTTP response to returnfile transmission timetotal = 2RTT+transmit timetime to transmit fileinitiate TCPconnectionRTTrequestfileRTTfilereceivedtimetimeApplication 2-27Persistent HTTPnon-persistent HTTP issues:requires 2 RTTs per objectOS overhead for each TCP connectio

35、nbrowsers often open parallel TCP connections to fetch referenced objectspersistent HTTPserver leaves connection open after sending responsesubsequent HTTP messages between same client/server sent over open connectionclient sends requests as soon as it encounters a referenced objectas little as one

36、RTT for all the referenced objectsApplication 2-28HTTP request messagetwo types of HTTP messages: request, responseHTTP request message:ASCII (human-readable format)request line(GET, POST, HEAD commands)header linescarriage return, line feed at startof line indicatesend of header linesApplication 2-

37、29GET /index.html HTTP/1.1rnHost: rnUser-Agent: Firefox/3.6.10rnAccept: text/html,application/xhtml+xmlrnAccept-Language: en-us,en;q=0.5rnAccept-Encoding: gzip,deflaternAccept-Charset: ISO-8859-1,utf-8;q=0.7rnKeep-Alive: 115rnConnection: keep-alivernrncarriage return characterline-feed characterHTTP

38、 request message: general formatApplication 2-30requestlineheaderlinesbodyUploading form inputPOST method:web page often includes form inputinput is uploaded to server in entity bodyURL method:uses GET methodinput is uploaded in URL field of request line:Application 2-31Method typesHTTP/1.0GETPOSTHE

39、ADasks server to leave requested object out of responseHTTP/1.1GET, POST, HEADPUTuploads file in entity body to path specified in URL fieldDELETEdeletes file specified in the URL fieldApplication 2-32HTTP response messagestatus line(protocolstatus codestatus phrase)header linesdata, e.g., requestedH

40、TML fileApplication 2-33HTTP/1.1 200 OKrnDate: Sun, 26 Sep 2021 20:09:20 GMTrnServer: Apache/2.0.52 (CentOS)rnLast-Modified: Tue, 30 Oct 2007 17:00:02 GMTrnETag: 17dc6-a5c-bf716880rnAccept-Ranges: bytesrnContent-Length: 2652rnKeep-Alive: timeout=10, max=100rnConnection: Keep-AlivernContent-Type: tex

41、t/html; charset=ISO-8859-1rnrndata data data data data . HTTP response status codes200 OKrequest succeeded, requested object later in this msg301 Moved Permanentlyrequested object moved, new location specified later in this msg (Location:)400 Bad Requestrequest msg not understood by server404 Not Fo

42、undrequested document not found on this server505 HTTP Version Not Supportedstatus code appears in 1st line in server-client response message.some sample codes:Application 2-34Trying out HTTP (client side) for yourself1. Telnet to your favorite Web server:opens TCP connection to port 80(default HTTP

43、 server port) at .anything typed in sent telnet 802. type in a GET HTTP request:GET /ross/ HTTP/1.1by typing this in (hit carriagereturn twice), you sendthis minimal (but complete) GET request to HTTP server3. look at response message sent by HTTP server!Application 2-35(or use Wireshark!)User-serve

44、r state: cookiesmany Web sites use cookiesfour components:1) cookie header line of HTTP response message2) cookie header line in HTTP request message3) cookie file kept on users host, managed by users browser4) back-end database at Web siteexample:Susan always access Internet from PCvisits specific

45、e-commerce site for first timewhen initial HTTP requests arrives at site, site creates: unique IDentry in backend database for IDApplication 2-36Cookies: keeping “state (cont.)clientserverusual http response msgusual http response msgcookie fileone week later:usual http request msgcookie: 1678cookie

46、-specificactionaccessebay 8734usual http request msgAmazon servercreates ID1678 for usercreate entryusual http response Set-cookie: 1678 ebay 8734amazon 1678usual http request msgcookie: 1678cookie-specificactionaccessebay 8734amazon 1678backenddatabaseApplication 2-37Cookies (continued)what cookies

47、 can bring:authorizationshopping cartsrecommendationsuser session state (Web e-mail)cookies and privacy:cookies permit sites to learn a lot about youyou may supply name and e-mail to sitesasidehow to keep “state:protocol endpoints: maintain state at sender/receiver over multiple transactionscookies:

48、 messages carry stateApplication 2-38Web caches (proxy server)user sets browser: Web accesses via cachebrowser sends all HTTP requests to cacheobject in cache: cache returns object else cache requests object from origin server, then returns object to clientGoal: satisfy client request without involv

49、ing origin serverclientProxyserverclientHTTP requestHTTP responseHTTP requestHTTP requestorigin serverorigin serverHTTP responseHTTP responseApplication 2-39More about Web cachingcache acts as both client and servertypically cache is installed by ISP (university, company, residential ISP)why Web cac

50、hing?reduce response time for client requestreduce traffic on an institutions access link.Internet dense with caches: enables “poor content providers to effectively deliver content (but so does P2P file sharing)Application 2-40Caching example assumptionsaverage object size = 100,000 bitsavg. request

51、 rate from institutions browsers to origin servers = 15/secdelay from institutional router to any origin server and back to router = 2 secconsequencesutilization on LAN = 15%utilization on access link = 100%total delay = Internet delay + access delay + LAN delay = 2 sec + minutes + millisecondsorigi

52、nserverspublic Internetinstitutionalnetwork10 Mbps LAN1.5 Mbps access linkinstitutionalcacheApplication 2-41Caching example (cont)possible solutionincrease bandwidth of access link to, say, 10 Mbpsconsequenceutilization on LAN = 15%utilization on access link = 15%Total delay = Internet delay + acces

53、s delay + LAN delay = 2 sec + msecs + msecsoften a costly upgradeoriginserverspublic Internetinstitutionalnetwork10 Mbps LAN10 Mbps access linkinstitutionalcacheApplication 2-42Caching example (cont)possible solution: install cacheconsequencesuppose hit rate is 0.440% requests will be satisfied almo

54、st immediately60% requests satisfied by origin serverutilization of access link reduced to 60%, resulting in negligible delays (say 10 msec)total avg delay = Internet delay + access delay + LAN delay = .6*(2.01) secs + .4*milliseconds 1.4 secsoriginserverspublic Internetinstitutionalnetwork10 Mbps L

55、AN1.5 Mbps access linkinstitutionalcacheApplication 2-43Conditional GETGoal: dont send object if cache has up-to-date cached versioncache: specify date of cached copy in HTTP requestIf-modified-since: server: response contains no object if cached copy is up-to-date: HTTP/1.0 304 Not Modifiedcacheser

56、verHTTP request msgIf-modified-since: HTTP responseHTTP/1.0 304 Not Modifiedobject not modifiedbeforeHTTP request msgIf-modified-since: HTTP responseHTTP/1.0 200 OKobject modifiedafter Application 2-44Chapter 2: Application layer2.1 Principles of network applications2.2 Web and HTTP2.3 FTP 2.4 Elect

57、ronic mailSMTP, POP3, IMAP2.5 DNS2.6 P2P applications2.7 Socket programming with TCP2.8 Socket programming with UDPApplication 2-45FTP: the file transfer protocoltransfer file to/from remote hostclient/server modelclient: side that initiates transfer (either to/from remote)server: remote hostftp: RF

58、C 959ftp server: port 21file transferFTPserverFTPuserinterfaceFTPclientlocal filesystemremote filesystemuser at hostApplication 2-46FTP: separate control, data connectionsFTP client contacts FTP server at port 21, TCP is transport protocolclient authorized over control connectionclient browses remot

59、e directory by sending commands over control connection.when server receives file transfer command, server opens 2nd TCP connection (for file) to clientafter transferring one file, server closes data connection.FTPclientFTPserverTCP control connection,server port 21TCP data connection,server port 20

60、server opens another TCP data connection to transfer another file.control connection: “out of bandFTP server maintains “state: current directory, earlier authenticationApplication 2-47FTP commands, responsessample commands:sent as ASCII text over control channelUSER usernamePASS passwordLIST return

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論