版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年小微企业货运司机劳动合同范本
- 2026 湖南 事业单位政府服务中心结构化面试高频强化训练卷含解析
- 2026 事业单位政府服务中心含解析
- 2026下半年高中语文教资面试古诗文重难点题库
- 2026年安全驾驶教练职业技能等级认定操作技能历年真题
- 2026年普通高等学校招生全国统一考试(全国乙卷)化学答案
- 2025年吉林省公主岭市高考历史模拟卷含答案【基础题】
- 2025年吉林省大安市高二生物下册期末考试模拟检测卷(各地真题)附答案
- 2026宠物经济产业链延伸与高端化发展趋势预测
- 2026光刻胶残留物清洗剂环保替代方案与成本效益分析报告
- 2026中国进出口银行招聘考试(专业知识)历年参考题库含答案详解
- (2026秋新版)部编版道德与法治四年级上册全册教案
- 2026年4月自考00037美学试题及答案含评分参考
- (新教材)2026年部编人教版一年级上册语文 6 j q x 课件
- 挖掘机租赁合同标准范本下载
- 减震垫片施工方案
- 责任心和执行力培训课件
- 2025年山西省教师职称考试(思想政治/道德与法治)历年参考题库含答案详解(5卷)
- 桉树买卖合同(2025版)
- 第9谭《艺术与科技的新结合》课件-2024-2025学年赣美版(2024)初中美术九年级上册
- DZ/T 0054-2014定向钻探技术规程
评论
0/150
提交评论