mecanismes d’echange d’informations chapter 2 application layer application layer.pdf · 2008....

23
1 Mecanismes d’Echange d’Informations Chapter 2 Application Layer Computer Networking: A Top Down Approach Featuring the Internet, A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers). They’re 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 part. In return for use, we only ask the following: 2: Application Layer 1 Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley, July 2004. following: If you use these slides (e.g., in a class) in substantially unaltered form, that you mention their source (after all, we’d like people to use our book!) If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Thanks and enjoy! JFK/KWR All material copyright 1996-2005 J.F Kurose and K.W. Ross, All Rights Reserved Chapter 2: Application layer 2.1 Principles of network applications network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2: Application Layer 2 2.6 P2P file sharing

Upload: others

Post on 05-Sep-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

1

Mecanismes d’Echange d’InformationsChapter 2Application Layer

Computer Networking: A Top Down Approach Featuring the Internet,

A note on the use of these ppt slides:We’re making these slides freely available to all (faculty, students, readers). They’re 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 part. In return for use, we only ask the following:

2: Application Layer 1

Featuring the Internet, 3rd edition. Jim Kurose, Keith RossAddison-Wesley, July 2004.

following:If you use these slides (e.g., in a class) in substantially unaltered form,

that you mention their source (after all, we’d like people to use our book!)If you post any slides in substantially unaltered form on a www site, that

you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material.

Thanks and enjoy! JFK/KWR

All material copyright 1996-2005J.F Kurose and K.W. Ross, All Rights Reserved

Chapter 2: Application layer

2.1 Principles of network applicationsnetwork applications2.2 Web and HTTP2.3 FTP 2.4 Electronic Mail

SMTP, POP3, IMAP2.5 DNS

2: Application Layer 2

2.6 P2P file sharing

Page 2: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

2

Chapter 2: Application LayerOur goals:

conceptual, l

learn about protocols by examining popular

li i l l implementation aspects of network application protocols

transport-layer service modelsclient-server

application-level protocols

HTTPFTPSMTP / POP3 / IMAPDNS

i t k

2: Application Layer 3

paradigmpeer-to-peer paradigm

programming network applications

socket API

Some network apps

E-mailWeb

Internet telephoneReal-time video Web

Instant messagingRemote loginP2P file sharingMulti-user network games

Real-time video conferenceMassive parallel computing

2: Application Layer 4

gStreaming stored video clips

Page 3: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

3

Creating a network appWrite programs that

run on different end systems and

applicationtransportnetworkdata linkphysicalsystems and

communicate over a network.e.g., Web: Web server software communicates with browser software

p y

applicationli ti

2: Application Layer 5

pptransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

Chapter 2: Application layer

2.1 Principles of network applications

2.6 P2P file sharingnetwork applications2.2 Web and HTTP2.3 FTP 2.4 Electronic Mail

SMTP, POP3, IMAP2.5 DNS

2: Application Layer 6

Page 4: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

4

Application architectures

Client-serverP t (P2P)Peer-to-peer (P2P)Hybrid of client-server and P2P

2: Application Layer 7

Client-server architectureserver:

always-on hostpermanent IP addresspermanent IP addressserver farms for scaling

clients:communicate with servermay be intermittently connectedmay have dynamic IP

2: Application Layer 8

may have dynamic IP addressesdo not communicate directly with each other

Page 5: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

5

Pure P2P architecture

no always-on serverarbitrary end systems arbitrary end systems directly communicatepeers are intermittently connected and change IP addressesexample: Gnutella

2: Application Layer 9

Highly scalable

But difficult to manage

Hybrid of client-server and P2P

NapsterFile transfer P2PFile transfer P2PFile search centralized:

• Peers register content at central server• Peers query same central server to locate content

2: Application Layer 10

Page 6: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

6

Processes communicating

Process: program running within a host.

Client process: process that initiates

within same host, two processes communicate using inter-process communication (defined by OS).processes in different

communicationServer process: process

that waits to be contacted

Note: applications with

2: Application Layer 11

processes in different hosts communicate by exchanging messages

Note applications with P2P architectures have client processes & server processes

Sockets

process sends/receives messages to/from its

host orserver

host orserver

g fsocketsocket analogous to door

sending process shoves message out doorsending process relies on transport infrastructure

th id f d hi h

process

TCP withbuffers,variables

socket

process

TCP withbuffers,variables

socket

Internet

controlled byapp developer

2: Application Layer 12

on other side of door which brings message to socket at receiving process

controlledby OS

API: (1) choice of transport protocol; (2) ability to fix a few parameters (lots more on this later)

Page 7: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

7

Addressing processesFor a process to receive messages, it must have an identifier

Identifier includes both the IP address and port numbersmust have an identifier

A host has a unique32-bit IP addressQ: does the IP address of the host on which the process runs suffice for identifying

and port numbersassociated with the process on the host.Example port numbers:

HTTP server: 80Mail server: 25

More on this later

2: Application Layer 13

suffice for identifying the process?Answer: No, many processes can be running on same host

More on this later

App-layer protocol defines

Types of messages exchanged, e.g., request

Public-domain protocols:defined in RFCsexchanged, e.g., request

& response messagesSyntax of message types: what fields in messages & how fields are delineatedSemantics of the fields

defined in RFCsallows for interoperabilitye.g., HTTP, SMTP

Proprietary protocols:e.g., KaZaA

2: Application Layer 14

Semantics of the fields, i.e., meaning of information in fieldsRules for when and how processes send & respond to messages

Page 8: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

8

What transport service does an app need?

Data losssome apps (e.g., audio) can tolerate some loss

Bandwidthsome apps (e.g.,

tolerate some lossother apps (e.g., file transfer, telnet) require 100% reliable data transfer

Timingsome apps (e g

multimedia) require minimum amount of bandwidth to be “effective”other apps (“elastic apps”) make use of

2: Application Layer 15

some apps (e.g., Internet telephony, interactive games) require low delay to be “effective”

whatever bandwidth they get

Transport service requirements of common apps

Application Data loss Bandwidth Time Sensitive

file transfere-mail

Web documentsreal-time audio/video

stored audio/videointeractive games

no lossno lossno lossloss-tolerant

loss-tolerantloss-tolerant

elasticelasticelasticaudio: 5kbps-1Mbpsvideo:10kbps-5Mbpssame as above few kbps up

nononoyes, 100’s msec

yes, few secsyes, 100’s msec

d

2: Application Layer 16

instant messaging no loss elastic yes and no

Page 9: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

9

Internet transport protocols services

TCP service:connection-oriented: setup

UDP service:unreliable data transfer connection oriented: setup

required between client and server processesreliable transport between sending and receiving processflow control: sender won’t overwhelm receiver congestion control: throttle

fbetween sending and receiving processdoes not provide: connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee

2: Application Layer 17

congestion control: throttle sender when network overloadeddoes not provide: timing, minimum bandwidth guarantees

Q: why bother? Why is there a UDP?

Internet apps: application, transport protocols

ApplicationApplicationlayer protocol

Underlyingtransport protocol

e-mailremote terminal access

Web file transfer

streaming multimedia

Internet telephony

SMTP [RFC 2821]Telnet [RFC 854]HTTP [RFC 2616]FTP [RFC 959]proprietary(e.g. RealNetworks)proprietary

TCPTCPTCPTCPTCP or UDP

2: Application Layer 18

(e.g., Vonage,Dialpad) typically UDP

Page 10: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

10

Chapter 2: Application layer

2.1 Principles of network applications

2.6 P2P file sharingnetwork applications

app architecturesapp requirements

2.2 Web and HTTP2.4 Electronic Mail

SMTP, POP3, IMAP2 5 DNS

2: Application Layer 19

2.5 DNS

Web and HTTP

First some jargonWeb page consists of objectsWeb page consists of objectsObject can be HTML file, JPEG image, Java applet, audio file,…Web page consists of base HTML-file which includes several referenced objectsEach object is addressable by a URL

2: Application Layer 20

Example URL:www.someschool.edu/someDept/pic.gif

host name path name

Page 11: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

11

HTTP overview

HTTP: hypertext transfer protocoltransfer protocolWeb’s application layer protocolclient/server model

client: browser that requests, receives, “displays” Web objectsserver: Web server

PC runningExplorer

Server running

Apache Web

2: Application Layer 21

server: Web server sends objects in response to requests

HTTP 1.0: RFC 1945HTTP 1.1: RFC 2068

p Wserver

Mac runningNavigator

HTTP overview (continued)

Uses TCP:client initiates TCP

HTTP is “stateless”server maintains no client initiates TCP

connection (creates socket) to server, port 80server accepts TCP connection from clientHTTP messages (application-layer protocol messages) exchanged between browser

minformation about past client requests

Protocols that maintain “state” are complex!past history (state) must be maintained

aside

2: Application Layer 22

exchanged between browser (HTTP client) and Web server (HTTP server)TCP connection closed

be maintainedif server/client crashes, their views of “state” may be inconsistent, must be reconciled

Page 12: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

12

HTTP request message

two types of HTTP messages: request, responseHTTP request message:HTTP request message:

ASCII (human-readable format)

GET /somedir/page.html HTTP/1.1Host: www.someschool.edu User-agent: Mozilla/4.0Connection: close

request line(GET, POST,

HEAD commands)

header

2: Application Layer 23

Connection: close Accept-language:fr

(extra carriage return, line feed)

lines

Carriage return, line feed

indicates end of message

HTTP response message

HTTP/1.1 200 OK

status line(protocol

status code /Connection closeDate: 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

d t d t d t d t d t

status codestatus phrase)

headerlines

data e g

2: Application Layer 24

data data data data data ... data, e.g., requestedHTML file

Page 13: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

13

HTTP response status codesIn first line in server->client response message.A few sample codes:200 OK

request succeeded, requested object later in this message301 Moved Permanently

requested object moved, new location specified later in this message (Location:)

400 Bad Request

2: Application Layer 25

qrequest message not understood by server

404 Not Foundrequested document not found on this server

505 HTTP Version Not Supported

Trying out HTTP (client side) for yourself

1. Telnet to your favorite Web server:O TCP ti t t 80Opens TCP connection to port 80(default HTTP server port) at cis.poly.edu.Anything typed in sent to port 80 at cis.poly.edu

telnet cis.poly.edu 80

2. Type in a GET HTTP request:GET /~ross/ HTTP/1.1H t i l d

By typing this in (hit carriagereturn twice) you send

2: Application Layer 26

Host: cis.poly.edu return twice), you sendthis minimal (but complete) GET request to HTTP server

3. Look at response message sent by HTTP server!

Page 14: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

14

Web caches (proxy server)

user sets browser: Web

Goal: satisfy client request without involving origin server

origin user sets browser: Web accesses via cachebrowser sends all HTTP requests to cache

object in cache: cache returns object else cache requests object from origin

client

Proxyserver

origin server

2: Application Layer 27

object from origin server, then returns object to client

clientorigin server

More about Web caching

Cache acts as both client and server

Why Web caching?Reduce response time for

Typically cache is installed by ISP (university, company, residential ISP)

Reduce response time for client request.Reduce traffic on an institution’s access link.

2: Application Layer 28

Page 15: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

15

Chapter 2: Application layer

2.1 Principles of network applications

2.6 P2P file sharing2 7 Socket programming network applications

2.2 Web and HTTP2.3 FTP2.4 Electronic Mail

SMTP, POP3, IMAP2.5 DNS

2.7 Socket programming with TCP2.8 Socket programming with UDP2.9 Building a Web server

2: Application Layer 29

FTP: the file transfer protocol

file transfer FTPFTPuser

FTP

transfer file to/from remote hostclient/server model

li t id th t i iti t t f ( ith t /f

serveruserinterface

client

local filesystem

remote filesystem

user at host

2: Application Layer 30

client: side that initiates transfer (either to/from remote)server: remote host

ftp: RFC 959ftp server: port 21

Page 16: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

16

FTP: separate control, data connections

FTP client contacts FTP server at port 21, specifying

TCP control connectionport 21

TCP as transport protocolClient obtains authorization over control connectionClient browses remote directory by sending commands over control connection.

FTPclient

FTPserver

TCP data connectionport 20

Server opens a second TCP data connection to transfer another file.Control connection: “out of

2: Application Layer 31

When server receives a command for a file transfer, the server opens a TCP data connection to clientAfter transferring one file, server closes connection.

Control connection: out of band”FTP server maintains “state”: current directory, earlier authentication

Chapter 2: Application layer

2.1 Principles of network applications

2.6 P2P file sharing2 7 Socket programming network applications

2.2 Web and HTTP2.3 FTP 2.4 Electronic Mail

SMTP, POP3, IMAP2.5 DNS

2.7 Socket programming with TCP2.8 Socket programming with UDP2.9 Building a Web server

2: Application Layer 32

Page 17: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

17

Electronic Mail

Three major components:user agents

user mailbox

outgoing message queue

mail

useragent

user agents mail servers simple mail transfer protocol: SMTP

User Agenta.k.a. “mail reader”composing editing reading

mailserver

useragent

useragent

usermail

mailserver

SMTP

SMTP

SMTP

2: Application Layer 33

composing, editing, reading mail messagese.g., Eudora, Outlook, elm, Netscape Messengeroutgoing, incoming messages stored on server

agentmail

server

useragent

useragent

Electronic Mail: mail servers

Mail Serversmailbox contains incoming il

useragent

mailbox contains incoming messages for usermessage queue of outgoing (to be sent) mail messagesSMTP protocol between mail servers to send email messages

client: sending mail

mailserver

useragent

useragent

usermail

mailserver

SMTP

SMTP

SMTP

2: Application Layer 34

client: sending mail server“server”: receiving mail server

u ragent

mailserver

useragent

useragent

Page 18: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

18

Scenario: Alice sends message to Bob1) Alice uses UA to compose

message and “to” [email protected]

2) Ali ’s UA s nds m ss

4) SMTP client sends Alice’s message over the TCP connection

5) Bob’s mail server places the 2) Alice s UA sends message to her mail server; message placed in message queue

3) Client side of SMTP opens TCP connection with Bob’s mail server

5) Bob s mail server places the message in Bob’s mailbox

6) Bob invokes his user agent to read message

2: Application Layer 35

useragent

mailserver

mailserver user

agent

1

2 3 4 56

Mail access protocols

useragentuser

agent

SMTP SMTP accessprotocol

SMTP: delivery/storage to receiver’s serverMail access protocol: retrieval from server

POP: Post Office Protocol [RFC 1939]• authorization (agent <-->server) and download

sender’s mail server

g

receiver’s mail server

2: Application Layer 36

authorization (agent < >server) and download IMAP: Internet Mail Access Protocol [RFC 1730]

• more features (more complex)• manipulation of stored msgs on server

HTTP: Hotmail , Yahoo! Mail, etc.

Page 19: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

19

POP3 protocol

authorization phaseclient commands:

S: +OK POP3 server ready C: user bob S: +OK C: pass hungry S: +OK user successfully logged on

user: declare usernamepass: password

server responses+OK-ERR

transaction phase, client:

C: list S: 1 498 S: 2 912 S: . C: retr 1 S: <message 1 contents>S: . C: dele 1

2: Application Layer 37

list: list message numbersretr: retrieve message by numberdele: deletequit

C: de eC: retr 2 S: <message 1 contents>S: . C: dele 2 C: quit S: +OK POP3 server signing off

POP3 (more) and IMAPMore about POP3

Previous example uses “d l d d d l t ”

IMAPKeep all messages in

l h “download and delete” mode.Bob cannot re-read e-mail if he changes client“Download-and-keep”:

one place: the serverAllows user to organize messages in foldersIMAP keeps user state across sessions:

2: Application Layer 38

copies of messages on different clientsPOP3 is stateless across sessions

names of folders and mappings between message IDs and folder name

Page 20: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

20

Chapter 2: Application layer

2.1 Principles of network applications

2.6 P2P file sharingnetwork applications2.2 Web and HTTP2.3 FTP 2.4 Electronic Mail

SMTP, POP3, IMAP2.5 DNS

2: Application Layer 39

DNS: Domain Name System

People: many identifiers:SSN name passport #

Domain Name System:distributed databaseSSN, name, passport #

Internet hosts, routers:IP address (32 bit) -used for addressing datagrams“name”, e.g., ww.yahoo.com - used by hum ns

distributed databaseimplemented in hierarchy of many name serversapplication-layer protocol

2: Application Layer 40

humansQ: map between IP

addresses and name ?

Page 21: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

21

DNS Why not centralize DNS?

single point of failureDNS services

Hostname to IP ptraffic volumedistant centralized databasemaintenance

d ’t l !

H maddress translationHost aliasing

Canonical and alias names

Mail server aliasingLoad distribution

2: Application Layer 41

doesn’t scale!Load distributionReplicated Web servers: set of IP addresses for one canonical name

Chapter 2: Application layer

2.1 Principles of network applications

2.6 P2P file sharingnetwork applications

app architecturesapp requirements

2.2 Web and HTTP2.4 Electronic Mail

SMTP, POP3, IMAP2 5 DNS

2: Application Layer 42

2.5 DNS

Page 22: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

22

P2P file sharing

ExampleAlice runs P2P client

Alice chooses one of the peers, Bob.File is copied from Alice runs P2P client

application on her notebook computerIntermittently connects to Internet; gets new IP address for each connection

pBob’s PC to Alice’s notebookWhile Alice downloads, other users uploading from Alice.Alice’s peer is both a

2: Application Layer 43

for each connectionAsks for “Hey Jude”Application displays other peers that have copy of Hey Jude.

Alice s peer is both a Web client and a transient Web server.

All peers are servers = highly scalable!

P2P: centralized directory

original “Napster” design1) when peer connects it

centralizeddirectory server

Bob

1) when peer connects, it informs central server:

IP addresscontent

2) Alice queries for “Hey Jude”

3) Alice requests file from

y

peers1

1

1

12

3

2: Application Layer 44

3) Alice requests file from Bob

Alice

Page 23: Mecanismes d’Echange d’Informations Chapter 2 Application Layer Application Layer.pdf · 2008. 5. 19. · 2 Chapter 2: Application Layer Our goals: conceptual, l learn about protocols

23

P2P: problems with centralized directory

Single point of failurePerformance

file transfer is decentralized, but Performance

bottleneckCopyright infringement

decentralized, but locating content is highly centralized

2: Application Layer 45

Chapter 2: Summary

Application architecturesclient server

Our study of network apps now complete!specific protocols:

HTTPclient-serverP2Phybrid

application service requirements:

reliability, bandwidth, delay

HTTPFTPSMTP, POP, IMAPDNS

2: Application Layer 46

delayInternet transport service model

connection-oriented, reliable: TCPunreliable, datagrams: UDP