全套英文版《计算机网络》ppt电子课件教案-chapter 2 application layer_第1页
全套英文版《计算机网络》ppt电子课件教案-chapter 2 application layer_第2页
全套英文版《计算机网络》ppt电子课件教案-chapter 2 application layer_第3页
全套英文版《计算机网络》ppt电子课件教案-chapter 2 application layer_第4页
全套英文版《计算机网络》ppt电子课件教案-chapter 2 application layer_第5页
已阅读5页,还剩62页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

2: Application Layer,1,Chapter 2: Application Layer,Chapter goals: conceptual + implementation aspects of network application protocolsclient server paradigmservice modelslearn about protocols by examining popular application-level protocols,More chapter goals specific protocols: httpftpsmtppop dnsprogramming network applicationssocket programming,2: Application Layer,2,Applications and application-layer protocols,Application: communicating, distributed processesrunning in network hosts in “user space”exchange messages to implement appe.g., email, file transfer, the WebApplication-layer protocolsone “piece” of an appdefine messages exchanged by apps and actions takenuser services provided by lower layer protocols,2: Application Layer,3,Network applications: some jargon,A process is a program that is running within a host.Within the same host, two processes communicate with interprocess communication defined by the OS.Processes running in different hosts communicate with an application-layer protocol,A user agent is an interface between the user and the network application.Web:browserE-mail: mail readerstreaming audio/video: media player,2: Application Layer,4,Client-server paradigm,Typical network app has two pieces: client and server,Client:initiates contact with server (“speaks first”)typically requests service from server, for Web, client is implemented in browser; for e-mail, in mail readerServer:provides requested service to cliente.g., Web server sends requested Web page, mail server delivers e-mail,2: Application Layer,5,Application-layer protocols (cont).,API: application programming interfacedefines interface between application and transport layersocket: Internet APItwo processes communicate by sending data into socket, reading data out of socket,Q: how does a process “identify” the other process with which it wants to communicate?IP address of host running other process“port number” - allows receiving host to determine to which local process the message should be delivered, lots more on this later.,2: Application Layer,6,What transport service does 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 “effective”,Bandwidthsome apps (e.g., multimedia) require minimum amount of bandwidth to be “effective”other apps (“elastic apps”) make use of whatever bandwidth they get,2: Application Layer,7,Transport service requirements of common apps,Applicationfile transfere-mailWeb documentsreal-time audio/videostored audio/videointeractive gamesfinancial apps,Data lossno lossno lossloss-tolerantloss-tolerantloss-tolerantloss-tolerantno loss,Bandwidthelasticelasticelasticaudio: 5Kb-1Mbvideo:10Kb-5Mbsame as above few Kbps upelastic,Time Sensitivenononoyes, 100s msecyes, few secsyes, 100s msecyes and no,2: Application Layer,8,Services provided by Internet transport protocols,TCP service:connection-oriented: setup required between client, serverreliable transport between sending and receiving processflow control: sender wont overwhelm receivercongestion control: throttle sender when network overloadeddoes not providing: timing, minimum bandwidth guarantees,UDP service:unreliable data transfer between sending and receiving processdoes not provide: connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee Q: why bother? Why is there a UDP?,2: Application Layer,9,Internet apps: their protocols and transport protocols,Applicatione-mailremote terminal accessWeb file transferstreaming multimediaremote file serverInternet telephony,Applicationlayer protocolsmtp RFC 821telnet RFC 854http RFC 2068ftp RFC 959proprietary(e.g. RealNetworks)NSFproprietary(e.g., Vocaltec),Underlyingtransport protocolTCPTCPTCPTCPTCP or UDPTCP or UDPtypically UDP,2: Application Layer,10,The Web: some jargon,Web page:consists of “objects”addressed by a URLMost Web pages consist of:base HTML page, andseveral referenced objects.URL has two components: host name and path name:,User agent for Web is called a browser:MS Internet ExplorerNetscape CommunicatorServer for Web is called Web server:Apache (public domain)MS Internet Information Server,www.someS/someDept/pic.gif,2: Application Layer,11,The Web: the http protocol,http: hypertext transfer protocolWebs application layer protocolclient/server modelclient: browser that requests, receives, “displays” Web objectsserver: Web server sends objects in response to requestshttp1.0: RFC 1945http1.1: RFC 2068,PC runningExplorer,Server runningNCSA Webserver,Mac runningNavigator,http request,http request,http response,http response,2: Application Layer,12,The http protocol: more,http: TCP transport service: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)TCP connection closed,http is “stateless”server maintains no information about past client requests,Protocols that maintain “state” are complex!past history (state) must be maintainedif server/client crashes, their views of “state” may be inconsistent, must be reconciled,aside,2: Application Layer,13,http example,Suppose user enters URL www.someS/someDepartment/home.index,1a. http client initiates TCP connection to http server (process) at www.someS. Port 80 is default for http server.,2. http client sends http request message (containing URL) into TCP connection socket,1b. http server at host www.someS waiting for TCP connection at port 80. “accepts” connection, notifying client,3. http server receives request message, forms response message containing requested object (someDepartment/home.index), sends message into socket,time,(contains text, references to 10 jpeg images),2: Application Layer,14,http example (cont.),5. http client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects,6. Steps 1-5 repeated for each of 10 jpeg objects,4. http server closes TCP connection.,time,2: Application Layer,15,Non-persistent and persistent connections,Non-persistentHTTP/1.0server parses request, responds, and closes TCP connection2 RTTs to fetch each objectEach object transfer suffers from slow start,Persistentdefault for HTTP/1.1on same TCP connection: server, parses request, responds, parses new request,.Client sends requests for all referenced objects as soon as it receives base HTML.Fewer RTTs and less slow start.,But most 1.0 browsers useparallel TCP connections.,2: Application Layer,16,http message format: request,two types of http messages: request, responsehttp request message:ASCII (human-readable format),GET /somedir/page.html HTTP/1.0 User-agent: Mozilla/4.0 Accept: text/html, image/gif,image/jpeg Accept-language:fr (extra carriage return, line feed),request line(GET, POST, HEAD commands),header lines,Carriage return, line feed indicates end of message,2: Application Layer,17,http request message: general format,2: Application Layer,18,http message format: respone,HTTP/1.0 200 OK Date: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 22 Jun 1998 . Content-Length: 6821 Content-Type: text/html data data data data data .,status line(protocolstatus codestatus phrase),header lines,data, e.g., requestedhtml file,2: Application Layer,19,http response status codes,200 OKrequest succeeded, requested object later in this message301 Moved Permanentlyrequested object moved, new location specified later in this message (Location:)400 Bad Requestrequest message not understood by server404 Not Foundrequested document not found on this server505 HTTP Version Not Supported,In first line in server-client response message.A few sample codes:,2: Application Layer,20,Trying out http (client side) for yourself,1. Telnet to your favorite Web server:,Opens TCP connection to port 80(default http server port) at www.eurecom.fr.Anything typed in sent to port 80 at www.eurecom.fr,telnet www.eurecom.fr 80,2. Type in a GET http request:,GET /ross/index.html HTTP/1.0,By typing this in (hit carriagereturn twice), you sendthis minimal (but complete) GET request to http server,3. Look at response message sent by http server!,2: Application Layer,21,User-server interaction: authentication,Authentication goal: control access to server documentsstateless: client must present authorization in each requestauthorization: typically name, passwordauthorization: header line in requestif no authorization presented, server refuses access, sendsWWW authenticate: header line in response,client,server,usual http request msg,401: authorization req.WWW authenticate:,Browser caches name & password sothat user does not have to repeatedly enter it.,2: Application Layer,22,User-server interaction: cookies,server sends “cookie” to client in response mstSet-cookie: 1678453client presents cookie in later requestscookie: 1678453server matches presented-cookie with server-stored infoauthenticationremembering user preferences, previous choices,client,server,usual http request msg,usual http response +Set-cookie: #,cookie-spectificaction,cookie-spectificaction,2: Application Layer,23,User-server interaction: conditional GET,Goal: dont send object if client has up-to-date stored (cached) versionclient: specify date of cached copy in http requestIf-modified-since: server: response contains no object if cached copy up-to-date: HTTP/1.0 304 Not Modified,client,server,http request msgIf-modified-since: ,object not modified,http request msgIf-modified-since: ,http responseHTTP/1.1 200 OK,object modified,2: Application Layer,24,Web Caches (proxy server),user sets browser: Web accesses via web cacheclient sends all http requests to web cacheif object at web cache, web cache immediately returns object in http response else requests object from origin server, then returns http response to client,Goal: satisfy client request without involving origin server,client,Proxyserver,client,http request,http request,http response,http response,http request,http response,http request,http response,origin server,origin server,2: Application Layer,25,Why Web Caching?,Assume: cache is “close” to client (e.g., in same network)smaller response time: cache “closer” to clientdecrease traffic to distant serverslink out of institutional/local ISP network often bottleneck,originservers,public Internet,institutionalnetwork,10 Mbps LAN,1.5 Mbps access link,institutionalcache,2: Application Layer,26,ftp: the file transfer protocol,transfer file to/from remote hostclient/server modelclient: side that initiates transfer (either to/from remote)server: remote hostftp: RFC 959ftp server: port 21,file transfer,remote filesystem,user at host,2: Application Layer,27,ftp: separate control, data connections,ftp client contacts ftp server at port 21, specifying TCP as transport protocoltwo parallel TCP connections opened:control: exchange commands, responses between client, server.“out of band control”data: file data to/from serverftp server maintains “state”: current directory, earlier authentication,2: Application Layer,28,ftp commands, responses,Sample commands:sent as ASCII text over control channelUSER usernamePASS passwordLIST return list of file in current directoryRETR filename retrieves (gets) fileSTOR filename stores (puts) file onto remote host,Sample return codesstatus code and phrase (as in http)331 Username OK, password required125 data connection already open; transfer starting425 Cant open data connection452 Error writing file,2: Application Layer,29,Electronic Mail,Three 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, incoming messages stored on server,2: Application Layer,30,Electronic Mail: mail servers,Mail Servers mailbox contains incoming messages (yet to be read) for usermessage queue of outgoing (to be sent) mail messagessmtp protocol between mail servers to send email messagesclient: sending mail server“server”: receiving mail server,2: Application Layer,31,Electronic Mail: smtp RFC 821,uses tcp to reliably transfer email msg from client to server, port 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 ASCII,2: Application Layer,32,Sample 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 . Recipient ok C: DATA S: 354 Enter mail, end with . on a line by itself C: Do you like ketchup? C: How about pickles? C: . S: 250 Message accepted for delivery C: QUIT S: 221 closing connection,2: Application Layer,33,try 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 email client (reader),2: Application Layer,34,smtp: final words,smtp uses persistent connectionssmtp requires that message (header & body) be in 7-bit asciicertain character strings are not permitted in message (e.g., CRLF.CRLF). Thus message has to be encoded (usually into either base-64 or quoted printable)smtp server uses CRLF.CRLF to determine end of message,Comparison with httphttp: pullemail: pushboth have ASCII command/response interaction, status codeshttp: each object is encapsulated in its own response messagesmtp: multiple objects message sent in a multipart message,2: Application Layer,35,Mail message format,smtp: 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 only,header,body,blankline,2: Application Layer,36,Message format: multimedia extensions,MIME: multimedia mail extension, RFC 2045, 2056additional lines in msg header declare MIME content type,multimedia datatype, subtype, parameter declaration,method usedto encode data,MIME version,encoded data,2: Application Layer,37,MIME typesContent-Type: type/subtype; parameters,Textexample subtypes: plain, htmlImageexample subtypes: jpeg, gifAudioexampe subtypes: basic (8-bit mu-law encoded), 32kadpcm (32 kbps coding),Videoexample subtypes: mpeg, quicktimeApplicationother data that must be processed by reader before “viewable”example subtypes: msword, octet-stream,2: Application Layer,38,Multipart Type,From: alicecrepes.fr To: Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=98766789 -98766789Content-Transfer-Encoding: quoted-printableContent-Type: text/plainDear Bob, Please find a picture of a crepe.-98766789Content-Transfer-Encoding: base64Content-Type: image/jpegbase64 encoded data . . .base64 encoded data -98766789-,2: Application Layer,39,Mail access protocols,SMTP: 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 1730more features (more complex)manipulation of stored msgs on serverHTTP: Hotmail , Yahoo! Mail, etc.,SMTP,POP3 orIMAP,receivers mail server,2: Application Layer,40,POP3 protocol,authorization phaseclient commands: user: declare usernamepass: passwordserver responses+OK-ERRtransaction phase, 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 off,S: +OK POP3 server ready C: user alice S: +OK C: pass hungry S: +OK user successfully logged on,2: Application Layer,41,DNS: Domain Name System,People: many identifiers:SSN, name, Passport #Internet hosts, routers:IP address (32 bit) - used for addressing datagrams“name”, e.g., - used by 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-layer protocolcomplexity at networks “edge”,2: Application Layer,42,DNS name servers,no server has all name-to-IP address mappingslocal name servers:each ISP, company has local (default) name serverhost DNS query first goes to local name serverauthoritative name server:for a host: stores that hosts IP address, namecan perform name/address translation for that hosts name,Why not centralize DNS?single point of failuretraffic volumedistant centralized databasemaintenancedoesnt scale!,2: Application Layer,43,DNS: Root name servers,contacted by local name server that can not resolve nameroot name server:contacts authoritative name server if name mapping not knowngets mappingreturns mapping to local name server dozen root name servers worldwide,2: Application Layer,44,Simple DNS example,host surf.eurecom.fr wants IP address

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论