版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、1Chapter 6 Application LayerA 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 l
2、ot 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 people to use our book!) If you post any slides in substantially unaltered form on a www site, that you
3、 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-2005J.F Kurose and K.W. Ross, All Rights Reserved2Chapter 6: Application layer5.1 Principles of network applications5.2 Web and HTTP5.3
4、FTP 5.4 Electronic MailSMTP, POP3, IMAP5.5 DNS5.6 P2P file sharing5.7 Socket programming with TCP5.8 Socket programming with UDP5.9 Building a Web server3Our goals: conceptual, implementation aspects of network application protocolstransport-layer service modelsclient-server paradigmpeer-to-peer par
5、adigmlearn about protocols by examining popular application-level protocolsHTTPFTPSMTP / POP3 / IMAPDNSprogramming network applicationssocket API4Some network appsE-mailWebInstant messagingRemote loginP2P file sharingMulti-user network gamesStreaming stored video clipsInternet telephoneReal-time vid
6、eo conferenceMassive parallel computing 5Creating a network appWrite programs thatrun on different end systems andcommunicate over a network.e.g., Web: Web server software communicates with browser softwarelittle software written for devices in network corenetwork core devices do not run user applic
7、ation codeapplication on end systems allows for rapid app development, propagationapplicationtransportnetworkdata linkphysicalapplicationtransportnetworkdata linkphysicalapplicationtransportnetworkdata linkphysical66.1 Principles of network applications7Application architecturesClient-serverPeer-to-
8、peer (P2P)Hybrid of client-server and P2P8Client-server architectureserver: always-on hostpermanent IP addressserver farms for scalingclients:communicate with servermay be intermittently connectedmay have dynamic IP addressesdo not communicate directly with each other9Pure P2P architectureno always-
9、on serverarbitrary end systems directly communicatepeers are intermittently connected and change IP addressesexample: BTHighly scalableBut difficult to manage10Hybrid of client-server and P2PNapsterFile transfer P2PFile search centralized: Peers register content at central serverPeers query same cen
10、tral server to locate contentInstant messagingChatting between two users is P2PPresence detection/location centralized:User registers its IP address with central server when it comes onlineUser contacts central server to find IP addresses of buddies11Processes communicatingProcess: program running w
11、ithin a host.within same host, two processes communicate using inter-process communication (defined by OS).processes in different hosts communicate by exchanging messagesClient process: process that initiates communicationServer process: process that waits to be contactedNote: applications with P2P
12、architectures have client processes & server processes12Socketsprocess sends/receives messages to/from its socketsocket analogous to doorsending process shoves message out doorsending process relies on transport infrastructure on other side of door which brings message to socket at receiving process
13、processTCP withbuffers,variablessockethost orserverprocessTCP withbuffers,variablessockethost orserverInternetcontrolledby OScontrolled byapp developerAPI: (1) choice of transport protocol; (2) ability to fix a few parameters (lots more on this later) 13Addressing processesFor a process to receive m
14、essages, it must have an identifierA host has a unique32-bit IP addressQ: does the IP address of the host on which the process runs suffice for identifying the process?Answer: No, many processes can be running on same hostIdentifier includes both the IP address and port numbers associated with the p
15、rocess on the host.Example port numbers:HTTP server: 80Mail server: 25More on this later14App-layer protocol definesTypes of messages exchanged, e.g., request & response messagesSyntax of message types: what fields in messages & how fields are delineatedSemantics of the fields, i.e., meaning of info
16、rmation in fieldsRules for when and how processes send & respond to messagesPublic-domain protocols:defined in RFCsallows for interoperabilitye.g., HTTP, SMTPProprietary protocols:e.g., KaZaA15What transport service does an app need?Data losssome apps (e.g., audio) can tolerate some lossother apps (
17、e.g., file transfer, telnet) require 100% reliable data transfer Timingsome apps (e.g., Internet telephony, interactive games) require low delay to be “effective”Bandwidthsome apps (e.g., multimedia) require minimum amount of bandwidth to be “effective”other apps (“elastic apps”) make use of whateve
18、r bandwidth they get 16Transport service requirements of common appsApplicationfile transfere-mailWeb documentsreal-time audio/videostored audio/videointeractive gamesinstant messagingData lossno lossno lossno lossloss-tolerantloss-tolerantloss-tolerantno lossBandwidthelasticelasticelasticaudio: 5kb
19、ps-1Mbpsvideo:10kbps-5Mbpssame as above few kbps upelasticTime Sensitivenononoyes, 100s msecyes, few secsyes, 100s msecyes and no17Internet transport protocols servicesTCP service:connection-oriented: setup required between client and server processesreliable transport between sending and receiving
20、processflow control: sender wont overwhelm receiver congestion control: throttle sender when network overloadeddoes not provide: timing, minimum bandwidth guaranteesUDP service:unreliable data transfer between sending and receiving processdoes not provide: connection setup, reliability, flow control
21、, congestion control, timing, or bandwidth guarantee Q: why bother? Why is there a UDP?18Internet apps: application, transport protocolsApplicatione-mailremote terminal accessWeb file transferstreaming multimediaInternet telephonyApplicationlayer protocolSMTP RFC 2821Telnet RFC 854HTTP RFC 2616FTP R
22、FC 959proprietary(e.g. RealNetworks)proprietary(e.g., Vonage,Dialpad)Underlyingtransport protocolTCPTCPTCPTCPTCP or UDPtypically UDP196.2 Web and HTTP20Web and HTTPFirst some jargonWeb page consists of objectsObject can be HTML file, JPEG image, Java applet, audio file,Web page consists of base HTML
23、-file which includes several referenced objectsEach object is addressable by a URLExample URL: host namepath name21HTTP overviewHTTP: hypertext transfer protocolWebs application layer protocolclient/server modelclient: browser that requests, receives, “displays” Web objectsserver: Web server sends o
24、bjects in response to requestsHTTP 1.0: RFC 1945HTTP 1.1: RFC 2068PC runningExplorerServer runningApache WebserverMac runningNavigatorHTTP requestHTTP requestHTTP responseHTTP response22HTTP overview (continued)Uses TCP:client initiates TCP connection (creates socket) to server, port 80server accept
25、s TCP connection from clientHTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server)TCP connection closedHTTP is “stateless”server maintains no information about past client requestsProtocols that maintain “state” are complex!past histo
26、ry (state) must be maintainedif server/client crashes, their views of “state” may be inconsistent, must be reconciledaside23HTTP request messagetwo types of HTTP messages: request, responseHTTP request message:ASCII (human-readable format)GET /somedir/page.html HTTP/1.1Host: User-agent: Mozilla/4.0C
27、onnection: close Accept-language:fr (extra carriage return, line feed) request line(GET, POST, HEAD commands)header linesCarriage return, line feed indicates end of message24HTTP response messageHTTP/1.1 200 OK Connection closeDate: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modi
28、fied: 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 file25User-server state: cookiesMany major Web sites use cookiesFour components:1) cookie header line of HTTP response m
29、essage2) cookie header line in HTTP request message3) cookie file kept on users host, managed by users browser4) back-end database at Web siteExample:Susan access Internet always from same PCShe visits a specific merce site for first timeWhen initial HTTP requests arrives at site, site creates a uni
30、que ID and creates an entry in backend database for ID26Web 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 req
31、uest without involving origin serverclientProxyserverclientHTTP requestHTTP requestHTTP responseHTTP responseHTTP requestHTTP responseorigin serverorigin server276.3 FTP 28FTP: the file transfer protocoltransfer file to/from remote hostclient/server modelclient: side that initiates transfer (either
32、to/from remote)server: remote hostftp: RFC 959ftp server: port 21file transferFTPserverFTPuserinterfaceFTPclientlocal filesystemremote filesystemuser at host29FTP: separate control, data connectionsFTP client contacts FTP server at port 21, specifying TCP as transport protocolClient obtains authoriz
33、ation over control connectionClient browses remote directory by sending commands over control connection.When server receives a command for a file transfer, the server opens a TCP data connection to clientAfter transferring one file, server closes connection.FTPclientFTPserverTCP control connectionp
34、ort 21TCP data connectionport 20Server opens a second TCP data connection to transfer another file.Control connection: “out of band”FTP server maintains “state”: current directory, earlier authentication30FTP commands, responsesSample commands:sent as ASCII text over control channelUSER usernamePASS
35、 passwordLIST return list of file in current directoryRETR filename retrieves (gets) fileSTOR filename stores (puts) file onto remote hostSample return codesstatus code and phrase (as in HTTP)331 Username OK, password required125 data connection already open; transfer starting425 Cant open data conn
36、ection452 Error writing file316.4 Electronic MailSMTP, POP3, IMAP32Electronic MailThree major components: user agents mail servers simple mail transfer protocol: SMTPUser Agenta.k.a. “mail reader”composing, editing, reading mail messagese.g., Eudora, Outlook, elm, Netscape Messengeroutgoing, ing mes
37、sages stored on serveruser mailboxoutgoing message queuemailserveruseragentuseragentuseragentmailserveruseragentuseragentmailserveruseragentSMTPSMTPSMTP33Electronic Mail: mail serversMail Servers mailbox contains ing messages for usermessage queue of outgoing (to be sent) mail messagesSMTP protocol
38、between mail servers to send email messagesclient: sending mail server“server”: receiving mail servermailserveruseragentuseragentuseragentmailserveruseragentuseragentmailserveruseragentSMTPSMTPSMTP34Electronic Mail: SMTP RFC 2821uses TCP to reliably transfer email message from client to server, port
39、 25direct transfer: sending server to receiving serverthree phases of transferhandshaking (greeting)transfer of messagesclosurecommand/response interactioncommands: ASCII textresponse: status code and phrasemessages must be in 7-bit ASCII35Scenario: Alice sends message to Bob1) Alice uses UA to comp
40、ose message and “to” bob2) Alices UA sends message to her mail server; message placed in message queue3) Client side of SMTP opens TCP connection with Bobs mail server4) SMTP client sends Alices message over the TCP connection5) Bobs mail server places the message in Bobs mailbox6) Bob invokes his u
41、ser agent to read messageuseragentmailservermailserveruseragent12345636Sample SMTP interaction S: 220 C: HELO crepes.fr S: 250 Hello crepes.fr, pleased to meet you C: MAIL FROM: S: 250 alicecrepes.fr. Sender ok C: RCPT TO: S: 250 bob . Recipient ok C: DATA S: 354 Enter mail, end with . on a line by
42、itself C: Do you like ketchup? C: How about pickles? C: . S: 250 Message accepted for delivery C: QUIT S: 221 closing connection37Try SMTP interaction for yourself:telnet servername 25see 220 reply from serverenter HELO, MAIL FROM, RCPT TO, DATA, QUIT commands above lets you send email without using
43、 email client (reader)38Mail message formatSMTP: protocol for exchanging email msgsRFC 822: standard for text message format:header lines, e.g.,To:From:Subject:different from SMTP commands!bodythe “message”, ASCII characters onlyheaderbodyblankline39Message format: multimedia extensionsMIME: multime
44、dia mail extension, RFC 2045, 2056additional lines in msg header declare MIME content typeFrom: alicecrepes.fr To: bob Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Type: image/jpeg base64 encoded data base64 encoded data multimedia datatype, subtype, p
45、arameter declarationmethod usedto encode dataMIME versionencoded data40Mail access protocolsSMTP: delivery/storage to receivers serverMail access protocol: retrieval from serverPOP: Post Office Protocol RFC 1939authorization (agent server) and download IMAP: Internet Mail Access Protocol RFC 1730mor
46、e features (more complex)manipulation of stored msgs on serverHTTP: Hotmail , Yahoo! Mail, etc.useragentsenders mail serveruseragentSMTPSMTPaccessprotocolreceivers mail server41POP3 protocolauthorization phaseclient commands: user: declare usernamepass: passwordserver responses+OK-ERRtransaction pha
47、se, client:list: list message numbersretr: retrieve message by numberdele: deletequit C: list S: 1 498 S: 2 912 S: . C: retr 1 S: S: . C: dele 1 C: retr 2 S: S: . C: dele 2 C: quit S: +OK POP3 server signing offS: +OK POP3 server ready C: user bob S: +OK C: pass hungry S: +OK user successfully logge
48、d on42POP3 (more) and IMAPMore about POP3Previous example uses “download and delete” mode.Bob cannot re-read e-mail if he changes client“Download-and-keep”: copies of messages on different clientsPOP3 is stateless across sessionsIMAPKeep all messages in one place: the serverAllows user to organize m
49、essages in foldersIMAP keeps user state across sessions:names of folders and mappings between message IDs and folder name436.5 DNS44DNS: Domain Name SystemPeople: many identifiers:SSN, name, passport #Internet hosts, routers:IP address (32 bit) - used for addressing datagrams“name”, e.g., - used by
50、humansQ: map between IP addresses and name ?Domain Name System:distributed database implemented in hierarchy of many name serversapplication-layer protocol host, routers, name servers to communicate to resolve names (address/name translation)note: core Internet function, implemented as application-l
51、ayer protocolcomplexity at networks “edge”45Why not centralize DNS?single point of failuretraffic volumedistant centralized databasemaintenancedoesnt scale!DNS servicesHostname to IP address translationHost aliasingCanonical and alias namesMail server aliasingLoad distributionReplicated Web servers:
52、 set of IP addresses for one canonical name46Root DNS Serverscom DNS serversorg DNS serversedu DNS serversDNS serversDNS servers DNS servers DNS servers DNS serversDistributed, Hierarchical DatabaseClient wants IP for ; 1st approx:Client queries a root server to find com DNS serverClient queries com DNS server to get DNS serverClient queries DNS server to get IP address for
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 吉林省吉林市(2024年-2025年小学五年级语文)统编版期中考试(下学期)试卷及答案
- 2024-2025学年重庆市八中高三上学期适应性月考卷(一)地理试题及答案
- 上海市县(2024年-2025年小学五年级语文)统编版能力评测(上学期)试卷及答案
- 二年级数学计算题专项练习集锦
- 高一化学上册全册教案
- DB11T 1480-2017 生产安全事故应急避难场所分级管理规范
- 演艺消费季剧场类演出项目补助申报书
- 河南省郑州市2024-2025学年高一上学期10月月考生物试卷(含答案)
- 2024-2025学年江西省景德镇市高一(上)期中物理试卷(含答案)
- 手动清洁器具市场需求与消费特点分析
- 毛竹脚手架施工方案
- HXN5型机车常见故障处理指导书
- 水泵技术规格书精编版
- 中南大学学位证书样本扫描件WORD
- 头颈部体格检查评分标准(共3页)
- 多重中介模型及其应用
- 可分离变量的微分方程(8)课件
- 苏教版小学一年级数学上册期末试卷
- 火灾报警系统技术规范书
- 苏J01-2005图集
- 装饰装修阶段重大危险源清单2(精华版)
评论
0/150
提交评论