




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、1Chapter 2Chapter 2Application LayerApplication LayerComputer Networking: A Computer Networking: A Top Down Approach Top Down Approach Featuring the InternetFeaturing the Internet, , 3 3rdrd edition. edition. Jim Kurose, Keith RossJim Kurose, Keith RossAddison-Wesley, July Addison-Wesley, July 2004.
2、 2004. 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, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our par
3、t. In return for use, we only ask the following:q If you use these slides (e.g., in a class) in substantially unaltered form, that you mention their source (after all, wed like people to use our book!)q If you post any slides in substantially unaltered form on a www site, that you note that they are
4、 adapted from (or perhaps identical to) our slides, and note our copyright of this material.Thanks and enjoy! JFK/KWRAll material copyright 1996-2004J.F Kurose and K.W. Ross, All Rights Reserved2Chapter 2: Application layerChapter 2: Application layerm2.1 Principles of network applicationsm2.2 Web a
5、nd HTTPm2.3 FTP m2.4 Electronic Mail SMTP, POP3, IMAPm2.5 DNSm2.6 P2P file sharing3Chapter 2: Application LayerChapter 2: Application LayerOur goals: mconceptual, implementation aspects of network application protocols transport-layer service models client-server paradigm peer-to-peer paradigmmlearn
6、 about protocols by examining popular application-level protocols HTTP FTP SMTP / POP3 / IMAP DNS4Some network appsSome network appsmE-mailmWebmInstant messagingmRemote loginmP2P file sharingmMulti-user network gamesmStreaming stored video clipsmInternet telephonemReal-time video conferencemMassive
7、parallel computing5Creating a network appCreating a network appWrite programs that run on different end systems and communicate over a network. e.g., Web: Web server software communicates with browser softwareNo software written for devices in network core Network core devices do not function at app
8、 layer This design allows for rapid app developmentapplicationtransportnetworkdata linkphysicalapplicationtransportnetworkdata linkphysicalapplicationtransportnetworkdata linkphysical6Chapter 2: Application layerChapter 2: Application layerm2.1 Principles of network applicationsm2.2 Web and HTTPm2.3
9、 FTP m2.4 Electronic Mail SMTP, POP3, IMAPm2.5 DNSm2.6 P2P file sharing7Application architecturesApplication architecturesmClient-servermPeer-to-peer (P2P)mHybrid of client-server and P2P8Client-server archictureClient-server archictureserver: always-on host permanent IP address server farms for sca
10、lingclients: communicate with server may be intermittently connected may have dynamic IP addresses do not communicate directly with each other9Pure P2P architecturePure P2P architecturemno always on servermarbitrary end systems directly communicatempeers are intermittently connected and change IP ad
11、dressesmexample: GnutellaHighly scalableBut difficult to manage10Hybrid of client-server and P2PHybrid of client-server and P2PNapster File transfer P2P File search centralized: Peers register content at central serverPeers query same central server to locate contentInstant messaging Chatting betwee
12、n two users is P2P Presence detection/location centralized: User registers its IP address with central server when it comes online User contacts central server to find IP addresses of buddies11Processes communicatingProcesses communicatingProcess: program running within a host.mwithin same host, two
13、 processes communicate using inter-process communication (defined by OS).mprocesses in different hosts communicate by exchanging messagesClient process: process that initiates communicationServer process: process that waits to be contactedmNote: applications with P2P architectures have client proces
14、ses & server processes12SocketsSocketsmprocess sends/receives messages to/from its socketmsocket analogous to door sending process shoves message out door sending process relies on transport infrastructure on other side of door which brings message to socket at receiving processprocessTCP withbuffer
15、s,variablessockethost orserverprocessTCP withbuffers,variablessockethost orserverInternetcontrolledby OScontrolled byapp developermAPI: (1) choice of transport protocol; (2) ability to fix a few parameters (lots more on this later) 13Addressing processesAddressing processesmFor a process to receive
16、messages, it must have an identifiermA host has a unique32-bit IP addressmQ: does the IP address of the host on which the process runs suffice for identifying the process?mAnswer: No, many processes can be running on same hostmIdentifier includes both the IP address and port numbers associated with
17、the process on the host.mExample port numbers: HTTP server: 80 Mail server: 2514App-layer protocol definesApp-layer protocol definesmTypes of messages exchanged, eg, request & response messagesmSyntax of message types: what fields in messages & how fields are delineatedmSemantics of the fields, ie,
18、meaning of information in fieldsmRules for when and how processes send & respond to messagesPublic-domain protocols:mdefined in RFCsmallows for interoperabilitymeg, HTTP, SMTPProprietary protocols:meg, KaZaA15What transport service does an app need?What transport service does an app need?Data lossms
19、ome apps (e.g., audio) can tolerate some lossmother apps (e.g., file transfer, telnet) require 100% reliable data transfer Timingmsome apps (e.g., Internet telephony, interactive games) require low delay to be “effective”Bandwidthmsome apps (e.g., multimedia) require minimum amount of bandwidth to b
20、e “effective”mother apps (“elastic apps”) make use of whatever bandwidth they get 16Transport service requirements of common appsTransport service requirements of common appsApplicationfile transfere-mailWeb documentsreal-time audio/videostored audio/videointeractive gamesinstant messagingData lossn
21、o lossno lossno lossloss-tolerantloss-tolerantloss-tolerantno lossBandwidthelasticelasticelasticaudio: 5kbps-1Mbpsvideo:10kbps-5Mbpssame as above few kbps upelasticTime Sensitivenononoyes, 100s msecyes, few secsyes, 100s msecyes and no17Internet transport protocols servicesInternet transport protoco
22、ls servicesTCP service:mconnection-oriented: setup required between client and server processesmreliable transport between sending and receiving processmflow control: sender wont overwhelm receiver mcongestion control: throttle sender when network overloadedmdoes not provide: timing, minimum bandwid
23、th guaranteesUDP service:munreliable data transfer between sending and receiving processmdoes not provide: connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee Q: why bother? Why is there a UDP?18Internet apps: application, transport protocolsInternet apps:
24、 application, transport protocolsApplicatione-mailremote terminal accessWeb file transferstreaming multimediaInternet telephonyApplicationlayer protocolSMTP RFC 2821Telnet RFC 854HTTP RFC 2616FTP RFC 959proprietary(e.g. RealNetworks)proprietary(e.g., Dialpad)Underlyingtransport protocolTCPTCPTCPTCPT
25、CP or UDPtypically UDP19Chapter 2: Application layerChapter 2: Application layerm2.1 Principles of network applicationsm2.2 Web and HTTPm2.3 FTP m2.4 Electronic Mail SMTP, POP3, IMAPm2.5 DNSm2.6 P2P file sharing20Web and HTTPWeb and HTTPFirst some jargonmWeb page consists of objectsmObject can be HT
26、ML file, JPEG image, Java applet, audio file,mWeb page consists of base HTML-file which includes several referenced objectsmEach object is addressable by a URLmExample URL:/someDept/pic.gifhost namepath name21HTTP overviewHTTP overviewHTTP: hypertext transfer protocolmWebs applicat
27、ion layer protocolmclient/server model client: browser that requests, receives, “displays” Web objects server: Web server sends objects in response to requestsmHTTP 1.0: RFC 1945mHTTP 1.1: RFC 2068PC runningExplorerServer runningApache WebserverMac runningNavigatorHTTP requestHTTP requestHTTP respon
28、seHTTP response22HTTP overview (continued)HTTP overview (continued)Uses TCP:mclient initiates TCP connection (creates socket) to server, port 80mserver accepts TCP connection from clientmHTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP
29、server)mTCP connection closedHTTP is “stateless”mserver maintains no information about past client requestsProtocols that maintain “state” are complex!mpast history (state) must be maintainedmif server/client crashes, their views of “state” may be inconsistent, must be reconciledaside23HTTP connecti
30、onsHTTP connectionsNonpersistent HTTPmAt most one object is sent over a TCP connection.mHTTP/1.0 uses nonpersistent HTTPPersistent HTTPmMultiple objects can be sent over single TCP connection between client and server.mHTTP/1.1 uses persistent connections in default mode24Nonpersistent HTTPNonpersis
31、tent HTTPSuppose user enters URL www.someS/someDepartment/home.index1a. HTTP client initiates TCP connection to HTTP server (process) at www.someS on port 802. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants ob
32、ject someDepartment/home.index1b. HTTP server at host www.someS waiting for TCP connection at port 80. “accepts” connection, notifying client3. HTTP server receives request message, forms response message containing requested object, and sends message into its sockettime(contains text, refe
33、rences to 10 jpeg images)25Nonpersistent HTTP (cont.)Nonpersistent HTTP (cont.)5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects6. Steps 1-5 repeated for each of 10 jpeg objects4. HTTP server closes TCP connection. time2
34、6Response time modelingResponse time modelingDefinition of RRT: time to send a small packet to travel from client to server and back.Response time:mone RTT to initiate TCP connectionmone RTT for HTTP request and first few bytes of HTTP response to returnmfile transmission timetotal = 2RTT+transmit t
35、imetime to transmit fileinitiate TCPconnectionRTTrequestfileRTTfilereceivedtimetime27Persistent HTTPPersistent HTTPNonpersistent HTTP issues:mrequires 2 RTTs per objectmOS must work and allocate host resources for each TCP connectionmbut browsers often open parallel TCP connections to fetch referenc
36、ed objectsPersistent HTTPmserver leaves connection open after sending responsemsubsequent HTTP messages between same client/server are sent over connectionPersistent without pipelining:mclient issues new request only when previous response has been receivedmone RTT for each referenced objectPersiste
37、nt with pipelining:mdefault in HTTP/1.1mclient sends requests as soon as it encounters a referenced objectmas little as one RTT for all the referenced objects28HTTP request messageHTTP request messagemtwo types of HTTP messages: request, responsemHTTP request message: ASCII (human-readable format)GE
38、T /somedir/page.html HTTP/1.1Host: User-agent: Mozilla/4.0Connection: close Accept-language:fr (extra carriage return, line feed) request line(GET, POST, HEAD commands)header linesCarriage return, line feed indicates end of message29HTTP request message: general formatHTTP request
39、 message: general format30Uploading form inputUploading form inputPost method:mWeb page often includes form inputmInput is uploaded to server in entity bodyURL method:mUses GET methodmInput is uploaded in URL field of request line: typesMethod typesHTTP/1.0mGETmPOSTmHEAD asks server to leave request
40、ed object out of responseHTTP/1.1mGET, POST, HEADmPUT uploads file in entity body to path specified in URL fieldmDELETE deletes file specified in the URL field32HTTP response messageHTTP response messageHTTP/1.1 200 OK Connection closeDate: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) L
41、ast-Modified: Mon, 22 Jun 1998 . Content-Length: 6821 Content-Type: text/html data data data data data . status line(protocolstatus codestatus phrase)header linesdata, e.g., requestedHTML file33HTTP response status codesHTTP response status codes200 OK request succeeded, requested object later in th
42、is message301 Moved Permanently requested object moved, new location specified later in this message (Location:)400 Bad Request request message not understood by server404 Not Found requested document not found on this server505 HTTP Version Not SupportedIn first line in server-client response messa
43、ge.A few sample codes:34Trying out HTTP (client side) for yourselfTrying out HTTP (client side) for yourself1. Telnet to your favorite Web server:Opens TCP connection to port 80(default HTTP server port) at .Anything typed in sent to port 80 at telnet 802. Type i
44、n a GET HTTP request:GET /ross/ HTTP/1.1Host: By typing this in (hit carriagereturn twice), you sendthis minimal (but complete) GET request to HTTP server3. Look at response message sent by HTTP server!35User-server state: cookiesUser-server state: cookiesMany major Web sites use cookies
45、Four components:1) cookie header line in the HTTP response message2) cookie header line in HTTP request message3) cookie file kept on users host and managed by users browser4) back-end database at Web siteExample: Susan access Internet always from same PC She visits a specific e-commerce site for fi
46、rst time When initial HTTP requests arrives at site, site creates a unique ID and creates an entry in backend database for ID36Cookies: keeping Cookies: keeping “statestate” (cont.) (cont.)clientserverusual http request msgusual http response +Set-cookie: 1678 usual http request msgcookie: 1678usual
47、 http response msgusual http request msgcookie: 1678usual http response msgcookie-specificactioncookie-spectificactionservercreates ID1678 for userentry in backend databaseaccessaccessCookie fileamazon: 1678ebay: 8734Cookie fileebay: 8734Cookie fileamazon: 1678ebay: 8734one week later:37Cookies (con
48、tinued)Cookies (continued)What cookies can bring:mauthorizationmshopping cartsmrecommendationsmuser session state (Web e-mail)Cookies and privacy:mcookies permit sites to learn a lot about youmyou may supply name and e-mail to sitesmsearch engines use redirection & cookies to learn yet moremadvertis
49、ing companies obtain info across sitesaside38Web caches (proxy server)Web caches (proxy server)muser sets browser: Web accesses via cachembrowser sends all HTTP requests to cache object in cache: cache returns object else cache requests object from origin server, then returns object to clientGoal: s
50、atisfy client request without involving origin serverclientProxyserverclientHTTP requestHTTP requestHTTP responseHTTP responseHTTP requestHTTP responseorigin serverorigin server39More about Web cachingMore about Web cachingmCache acts as both client and servermTypically cache is installed by ISP (un
51、iversity, company, residential ISP)Why Web caching?mReduce response time for client request.mReduce traffic on an institutions access link.mInternet dense with caches enables “poor” content providers to effectively deliver content (but so does P2P file sharing)40Conditional GETConditional GETmGoal:
52、dont send object if cache has up-to-date cached versionmcache: specify date of cached copy in HTTP requestIf-modified-since: mserver: response contains no object if cached copy is up-to-date: HTTP/1.0 304 Not ModifiedcacheserverHTTP request msgIf-modified-since: HTTP responseHTTP/1.0 304 Not Modifie
53、dobject not modifiedHTTP request msgIf-modified-since: HTTP responseHTTP/1.0 200 OKobject modified41Chapter 2: Application layerChapter 2: Application layerm2.1 Principles of network applicationsm2.2 Web and HTTPm2.3 FTP m2.4 Electronic Mail SMTP, POP3, IMAPm2.5 DNSm2.6 P2P file sharing42FTP: the fi
54、le transfer protocolFTP: the file transfer protocolmtransfer file to/from remote hostmclient/server model client: side that initiates transfer (either to/from remote) server: remote hostmftp: RFC 959mftp server: port 21file transferFTPserverFTPuserinterfaceFTPclientlocal filesystemremote filesystemu
55、ser at host43FTP: separate control, data connectionsFTP: separate control, data connectionsmFTP client contacts FTP server at port 21, specifying TCP as transport protocolmClient obtains authorization over control connectionmClient browses remote directory by sending commands over control connection
56、.mWhen server receives a command for a file transfer, the server opens a TCP data connection to clientmAfter transferring one file, server closes connection.FTPclientFTPserverTCP control connectionport 21TCP data connectionport 20mServer opens a second TCP data connection to transfer another file.mC
57、ontrol connection: “out of band”mFTP server maintains “state”: current directory, earlier authentication44FTP commands, responsesFTP commands, responsesSample commands:msent as ASCII text over control channelmUSER usernamemPASS passwordmLIST return list of file in current directorymRETR filename ret
58、rieves (gets) filemSTOR filename stores (puts) file onto remote hostSample return codesmstatus code and phrase (as in HTTP)m331 Username OK, password requiredm125 data connection already open; transfer startingm425 Cant open data connectionm452 Error writing file45Chapter 2: Application layerChapter
59、 2: Application layerm2.1 Principles of network applicationsm2.2 Web and HTTPm2.3 FTP m2.4 Electronic Mail SMTP, POP3, IMAPm2.5 DNSm2.6 P2P file sharing46Electronic MailElectronic MailThree major components: muser agents mmail servers msimple mail transfer protocol: SMTPUser Agentma.k.a. “mail reade
60、r”mcomposing, editing, reading mail messagesme.g., Eudora, Outlook, elm, Netscape Messengermoutgoing, incoming messages stored on serveruser mailboxoutgoing message queuemailserveruseragentuseragentuseragentmailserveruseragentuseragentmailserveruseragentSMTPSMTPSMTP47Electronic Mail: mail serversEle
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 勞動合同服務期-樣本
- 張小嫻《刻骨的愛人》簡介及讀后感
- 蛋白質組技術優化-洞察及研究
- 固態電解質開發-洞察及研究
- 媒體公信力危機-洞察及研究
- 古詩詞誦讀《春江花月夜》課件+2024-2025學年統編版高中語文選擇性必修上冊
- 突發公共衛生事件應對-第2篇-洞察及研究
- 初中物理新教科版八年級上冊第一章本章復習訓練教案2025秋
- 2025年超星爾雅學習通《勞動通論》章節測試往年題考
- 2025年超星爾雅學習通《勞動通論》章節測試必考題
- 2025年廣東省廣州市白云區中考數學二模試卷
- 創造性思維與創新方法(大連民族大學)知到網課答案
- 2024北京西城區四年級(下)期末數學試題及答案
- GB 42590-2023民用無人駕駛航空器系統安全要求
- 杭州網約車從業資格考試題庫與答案
- 敏捷項目管理:敏捷革命課件
- 亞馬遜品牌授權書(英文模板)
- Box-Behnken-Design
- 鋼管懸挑腳手架方案
- 新時達機器人系統說明書
- 圖形推理圖形匯總62頁
評論
0/150
提交評論