Applikasjoner • Disposisjon Î overføringsproblematikk Î navnetjener Î world wide web 5/8/2003 Slide 1 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:browser ÎE-mail: mail reader Îstreaming audio/video: media player 5/8/2003 Slide 2 System arkitektur Tjener Klient Disk Komm. Prog. vare Disk Navne tjener Komm. Prog. vare B r u k e r LAN LAN Internett 5/8/2003 Slide 3 1 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 reader Server: • provides requested service to client • e.g., Web server sends requested Web page, mail server delivers email application transport network data link physical request reply application transport network data link physical 5/8/2003 Slide 4 Overføringsproblemer • Data representeres på ulik måte i ulike maskiner på grunn av forskjell i: Î hardware – ”Small-endians” og ”Big-endians” maskiner – 1-komplement og 2-komplement logikk – ordstørrelse Æ 32-bit maskin til 64-bit maskin komm. Î operativsystem Î programmeringsspråk og kompilere – forskjellig lokal representasjon – EBCDIC (IBM) til ASCII eller IA5 (standard) 5/8/2003 Slide 5 Eksempel; hardwareforskjeller Integerverdien 34.677.374 Mest signif. Big-endians 00000010 00010001 00100010 01111110 Byte 4 Small-endians Byte 1 01111110 00100010 00010001 00000010 Minst signifik. 5/8/2003 Minst signif. Mest signifik. Slide 6 2 Overføringssyntaks Applik. data Applik. data Presentasjons koding Pakke 1 Presentasjons dekoding Pakke 2 Pakke 3 Data må overføres i en overføringssyntaks som begge sider oppfatter på samme måte 5/8/2003 Slide 7 Abstrakt syntaks/overføringssyntaks Abstrakt syntaks kompilator Lokal repr. Applik.pros. Koding og innpakking (marshalling) Abstrakt kontekst Felles samtaleunivers Datastrukturer Operasjoner Abstrakt syntaks Overføringssyntaks Lokal repr. Applik.pros. Deoding og utpakking (marshalling) 5/8/2003 Slide 8 Marshalling/serialisering Applikasjonens datastruktur Serialisering 5/8/2003 Marshalling • konvertering • serialisering • innpakking Slide 9 3 ASN.1 eksempler Integer > 65 535 32-bits maskin; representert i et 32-bits ord 16-bits maskin; representert i to 16-bits ord Primitive typer: Hver datatype kodes ved overføring: Type Lengde Verdi Type lengde type lengde verdi type lengde verdi Bolean Integer Bit streng Oktett streng Null Objekt ID Objekt deskrip. Real Struktur typer INT 4 B1 B2 B3 B4 5/8/2003 Slide 10 Protokollstrukturen i UNIX Applikasjon User space Sockets Kernel TCP UDP IP Ethernet 5/8/2003 Slide 11 What transport service does an app need? Data loss • some apps (e.g., audio) can tolerate some loss • other apps (e.g., file transfer, telnet) require 100% reliable data transfer Bandwidth • some apps (e.g., multimedia) require minimum amount of bandwidth to be “effective” • other apps (“elastic apps”) make use of whatever bandwidth they get 5/8/2003 Timing • some apps (e.g., Internet telephony, interactive games) require low delay to be “effective” Slide 12 4 Transport service requirements of common apps Data loss Bandwidth Time Sensitive file transfer e-mail Web documents real-time audio/video no loss no loss loss-tolerant loss-tolerant no no no yes, 100’s msec stored audio/video interactive games financial apps loss-tolerant loss-tolerant no loss elastic elastic elastic audio: 5Kb-1Mb video:10Kb-5Mb same as above few Kbps up elastic Application yes, few secs yes, 100’s msec yes and no 5/8/2003 Slide 13 Internet apps: their protocols and transport protocols Application e-mail remote terminal access Web file transfer streaming multimedia remote file server Internet telephony Application layer protocol Underlying transport protocol smtp [RFC 821] telnet [RFC 854] http [RFC 2068] ftp [RFC 959] proprietary (e.g. RealNetworks) NSF proprietary (e.g., Vocaltec) TCP TCP TCP TCP TCP or UDP TCP or UDP typically UDP 5/8/2003 Slide 14 Aksjoner på ulike protokollnivåer Bruker: connect odin.unik.no Gethostbyname (odin.unik.no Æ 193.156.96.215) Applikasjon Getservicebyname (tcp Æ 21) Socket (tcp; Port # > 1023) Connect (193.156.96.215; 21 TCP TCP-PDU: (TCP-CON) Send(193.156.96.215; SDU) IP-addr Æ MAC addr IP IP-PDU: (Data) Send(MAC-addr; Data) Ethernet 5/8/2003 Ether-PDU: Data Slide 15 5 Navnetjenere 5/8/2003 Slide 16 Navnetjener • Konvertere fra navn til adresser Î navn er brukervennlig Î adresser er nødvendig for fremsending av pakker Î husk; et endepunkt for en forbindelse er identifisert ved tripletten: • IP-adresse; IP-SAP (Protocol); T-SAP (T-Port) • Service (for eks. FTP) Æ vel-kjent port 5/8/2003 Slide 17 Organisering av navnetjenesten • Organisert hierarkisk i domener, Î reflekteres i navnekonvensjonen • for eks. ”baugi.ifi.uio.no” Î hvert domene er ansvarlig for sitt navneområde Î fleksibelt og forenkler administrasjonen 5/8/2003 Slide 18 6 Navnehierarkiet og soner Generisk Land Rot-sone adm. NIC com edu mil gov org uk no se uio princeton berkeley arpa ifi fys baugi mjolnir skibladnir • hver sone korresponderer med to eller flere navnetjenere • en navnetjener kan implementere en eller flere soner 5/8/2003 Slide 19 Hierarki av navnetjenere Rot navnetjener no navnetjener uio navnetjener ifi navnetjener 5/8/2003 Slide 20 Navn- adresse transaksjoner 1 rot tjener Baugi.if.uio.no 2 Klient Lokal tjener 129.240.64.36 no tjener 3 4 uio tjener ifi tjener 5/8/2003 Slide 21 7 The Web: some jargon • Web page: Îconsists of “objects” Îaddressed by a URL • Most Web pages consist of: Îbase HTML page, and Îseveral referenced objects. • URL has two components: host name and path name: • User agent for Web is called a browser: ÎMS Internet Explorer ÎNetscape Communicator • Server for Web is called Web server: ÎApache (public domain) ÎMS Internet Information Server www.someSchool.edu/someDept/pic.gif 5/8/2003 Slide 22 The Web: the http protocol http: hypertext transfer protocol • Web’s application layer protocol • client/server model Îclient: browser that requests, receives, “displays” Web objects Îserver: Web server sends objects in response to requests • http1.0: RFC 1945 • http1.1: RFC 2068 htt PC running Explorer htt pr equ est pr esp ons e est equ Server pr nse htt running spo re NCSA Web tp ht server Mac running Navigator Port 80 is default for http server. 5/8/2003 Slide 23 The http protocol: more http is “stateless” • server maintains no information about past client requests 5/8/2003 Slide 24 8 http message format: request • two types of http messages: request, response • http request message: ÎASCII (human-readable format) request line (GET, POST, HEAD commands) GET /somedir/page.html HTTP/1.0 User-agent: Mozilla/4.0 Accept: text/html, image/gif,image/jpeg header Accept-language:fr lines Carriage return, line feed indicates end of message (extra carriage return, line feed) 5/8/2003 Slide 25 http request message: general format 5/8/2003 Slide 26 http message format: response status line (protocol status code status phrase) header lines data, e.g., requested html file 5/8/2003 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 ... Slide 27 9 Trying out http (client side) for yourself 1. Telnet to your favorite Web server: telnet www.eurecom.fr 80 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 2. Type in a GET http request: By typing this in (hit carriage return twice), you send this minimal (but complete) GET request to http server GET /~ross/index.html HTTP/1.0 3. Look at response message sent by http server! 5/8/2003 Slide 28 User-server interaction: cookies • server sends “cookie” to client in response mst Set-cookie: 1678453 • client presents cookie in later requests cookie: 1678453 • server matches presented-cookie with server-stored info Îauthentication Îremembering user preferences, previous 5/8/2003 choices server client usual http request msg usual http response + Set-cookie: # usual http request msg cookie: # usual http response msg usual http request msg cookie: # usual http response msg cookiespectific action cookiespectific action Slide 29 Web Caches (proxy server) Goal: satisfy client request without involving origin • server user sets browser: Web accesses via web cache • client sends all http requests to web cache Îif object at web cache, web cache immediately returns object in http response Îelse requests object from origin server, then returns http response to client 5/8/2003 origin server htt Proxy t pr server reques e equ est p ns htt res spo e r pon tp se ht est htt pr equ equ pr nse htt est htt spo pr e r esp p t ons ht e client http client origin server Slide 30 10 Why Web Caching? Assume: cache is “close” to client (e.g., in same network) • smaller response time: cache “closer” to client • decrease traffic to distant servers Îlink out of institutional/local ISP network often 5/8/2003 bottleneck origin servers public Internet 1.5 Mbps access link institutional network 10 Mbps LAN institutional cache Slide 31 11