42
1 Application layer Principles of network applications Web and HTTP FTP Electronic Mail SMTP, POP3, IMAP DNS

Application layer

  • Upload
    diallo

  • View
    50

  • Download
    1

Embed Size (px)

DESCRIPTION

Principles of network applications Web and HTTP FTP Electronic Mail SMTP, POP3, IMAP DNS. Application layer. Figure 2.16 TCP/IP and OSI model. Figure 2.14 Application layer. The application layer is responsible for providing services to the user. Figure 2.15 Summary of layers. - PowerPoint PPT Presentation

Citation preview

Page 1: Application layer

1

Application layer

Principles of network applications

Web and HTTP FTP Electronic Mail

SMTP, POP3, IMAP

DNS

Page 2: Application layer

2

Figure 2.16 TCP/IP and OSI model

Page 3: Application layer

3

Figure 2.14 Application layer

The application layer is responsible for providing services to the user.

Page 4: Application layer

4

Figure 2.15 Summary of layers

Page 5: Application layer

5

Application LayerOur goals: conceptual,

implementation aspects of network application protocolstransport-layer

service modelsclient-server

paradigm peer-to-peer

paradigm

learn about protocols by examining popular application-level protocols HTTP FTP SMTP / POP3 /

IMAP DNS

Page 6: Application layer

6

Some network apps

E-mail Web Instant messaging Remote login P2P file sharing Multi-user network

games Streaming stored

video clips

Internet telephone Real-time video

conference Massive parallel

computing

Page 7: Application layer

7

Creating a network app

Write programs that run on different end

systems and communicate over a

network. e.g., Web: Web server

software communicates with browser software

application

transport

networkdata linkphysical

application

transport

networkdata linkphysical

application

transport

networkdata linkphysical

Page 8: Application layer

8

Application architectures

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

Page 9: Application layer

9

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, E-banking) require 100% reliable data transfer

Timing some apps (e.g.,

Internet telephony, interactive games) require low delay to be “effective”

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

Page 10: Application layer

10

Internet transport protocols servicesTCP service: connection-oriented: setup

required between client and server processes

reliable transport between sending and receiving process

flow control: sender won’t overwhelm receiver

congestion control: throttle sender when network overloaded

does not providing: timing, minimum bandwidth guarantees

UDP service: unreliable data

transfer between sending and receiving process

does not provide: connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee

Page 11: Application layer

11

Web and HTTP: 1st application protocol

First some jargon Web page consists of objects Object can be HTML file, JPEG image, Java

applet, audio file,… Web page consists of base HTML-file

which includes several referenced objects Each object is addressable by a URL Example URL:

www.someschool.edu/someDept/pic.gif

host name path name

Page 12: Application layer

12

HTTP overview

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

HTTP 1.0: RFC 1945 HTTP 1.1: RFC 2068

PC runningExplorer

Server running

Apache Webserver

Mac runningNavigator

HTTP request

HTTP request

HTTP response

HTTP resp

onse

Page 13: Application layer

13

HTTP overview (continued)Uses TCP: client initiates TCP

connection (creates socket) to server, port 80 (well-known)

server accepts TCP connection from client

HTTP 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 (we can use cookies for implementing state)

Page 14: Application layer

14

HTTP connections

Nonpersistent HTTP At most one object

is sent over a TCP connection.

HTTP/1.0 uses nonpersistent HTTP

Persistent HTTP Multiple objects

can be sent over single TCP connection between client and server.

HTTP/1.1 uses persistent connections in default mode

Page 15: Application layer

15

Non-persistent HTTPSuppose user enters URL www.cse.cuhk.edu.hk/index.html

1a. HTTP client initiates TCP connection to HTTP server (process) at www.cse.cuhk.edu.hk on port 80

2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object index.html

1b. HTTP server at host www.cse.cuhk.edu.hk waiting for TCP connection at port 80. “accepts” connection, notifying client

3. HTTP server receives request message, forms response message containing requested object, and sends message into its socket

time

(contains text, references to 10

jpeg images)

CLIENT Server

(we don’t send jpeg here)

Page 16: Application layer

16

Nonpersistent HTTP (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

Page 17: Application layer

17

Web caches (proxy server)

user sets browser: Web accesses via cache

browser sends all HTTP requests to cache object in cache:

cache returns object

else cache requests object from origin server, then returns object to client

Goal: satisfy client request without involving origin server

client

Proxyserver

client

HTTP request

HTTP request

HTTP response

HTTP resp

onse

HTTP request

HTTP response

origin server

origin server

Page 18: Application layer

18

FTP: the file transfer protocol

transfer file to/from remote host client/server model

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

server: remote host ftp: RFC 959 ftp server: port 21

file transfer FTPserver

FTPuser

interface

FTPclient

local filesystem

remote filesystem

user at

host

Page 19: Application layer

19

FTP: separate control, data connections

FTP client contacts FTP server at port 21, specifying TCP as transport protocol

Client obtains authorization over control connection

Client 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 client

After transferring one file, server closes connection.

FTPclient

FTPserver

TCP control connectionport 21

TCP data connectionport 20

Server opens a second TCP data connection to transfer another file.

FTP server maintains “state”: current directory, earlier authentication (unlike http which doesn’t maintain state)

Page 20: Application layer

20

Electronic Mail

Three major components:

user agents mail servers simple mail transfer

protocol: SMTP

User Agent a.k.a. “mail reader” composing, editing, reading

mail messages e.g., Eudora, Outlook, elm,

pine, Netscape Messenger outgoing, incoming

messages stored on server

user mailbox

outgoing message queue

mailserver

useragent

useragent

useragent

mailserver

useragent

useragent

mailserver

useragent

SMTP

SMTP

SMTP

Page 21: Application layer

21

Electronic Mail: mail servers

Mail Servers mailbox contains

incoming messages for user

message queue of outgoing (to be sent) mail messages

SMTP protocol between mail servers to send email messages client: sending mail

server “server”: receiving

mail server

mailserver

useragent

useragent

useragent

mailserver

useragent

useragent

mailserver

useragent

SMTP

SMTP

SMTP

Page 22: Application layer

22

Electronic Mail: SMTP [RFC 2821]

uses TCP to reliably transfer email message from client to server, port 25

direct transfer: sending server to receiving server

three phases of transfer handshaking (greeting) transfer of messages closure

command/response interaction commands: ASCII text response: status code and phrase

messages must be in 7-bit ASCII (problem when we send multimedia files)

Page 23: Application layer

23

Scenario: Alice sends message to Bob

1) Alice uses pine to compose message and “to” [email protected]

2) Alice’s pine sends message to her mail server; message placed in message queue

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

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

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

6) Bob invokes his user agent to read message

useragent

mailserver

mailserver user

agent

1

2 3 4 56

Page 24: Application layer

24

Mail message formatSMTP: protocol for

exchanging email messagesRFC 822: standard for text

message format: header lines, e.g.,

To: From: Subject:different from SMTP

commands! body

the “message”, ASCII characters only

This doesn’t work for multimedia (e.g, video/audio) data.

header

body

blankline

Define what is a message. In other words, the data format

(????????)

Page 25: Application layer

25

Message format: multimedia extensions MIME: multimedia mail extension, RFC 2045

(audio), 2056 (video) additional lines in msg header declare MIME

content type

From: [email protected] To: [email protected] 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,

parameter declaration

method usedto encode data

MIME version

encoded data

Page 26: Application layer

26

MIME typesContent-Type: type/subtype; parameters

Text example subtypes:

plain, html

Image example subtypes:

jpeg, gif

Audio exampe subtypes:

basic (8-bit mu-law encoded), 32kadpcm (32 kbps coding)

Video example subtypes:

mpeg, quicktime

Application other data that must

be processed by reader before “viewable”

example subtypes: msword, octet-stream (pdf format)

Page 27: Application layer

27

Mail access protocols

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

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

and password) IMAP: Internet Mail Access Protocol [RFC 1730]

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

HTTP: Hotmail , Yahoo! Mail, etc.

useragent

sender’s mail server

useragent

SMTP SMTP accessprotocol

receiver’s mail server

Page 28: Application layer

28

DNS: Domain Name SystemPeople: many identifiers:

HKID#, name, passport #, CUHK ID #...etc

Internet hosts, routers: IP address (32 bit) - used

for addressing datagrams “name”, e.g.,

idiotville.cse.cuhk.edu.hk - used by humans

Q: map between IP addresses and name ?

Domain Name System: distributed database

implemented in hierarchy of many name servers

application-layer protocol: host, routers, name servers to communicate to resolve names (address/name translation)

Page 29: Application layer

29

DNS

Why not centralize DNS?

single point of failure

traffic volume distant centralized

database maintenance

DNS services Hostname to IP

address translation

Host aliasing Canonical and alias

names

Mail server aliasing

IP to hostname mapping

Page 30: Application layer

30

Root DNS Servers

com DNS servers org DNS servers edu DNS servers

poly.eduDNS servers

umass.eduDNS servers

yahoo.comDNS servers

amazon.comDNS servers

pbs.orgDNS servers

Distributed, Hierarchical Database

Client wants IP for www.amazon.com; 1st approx: Client queries a root server to find com DNS

server Client queries com DNS server to get

amazon.com DNS server Client queries amazon.com DNS server to get

IP address for www.amazon.com

Page 31: Application layer

31

DOMAIN NAME SPACEDOMAIN NAME SPACE

To have a hierarchical name space, a domain name To have a hierarchical name space, a domain name space was designed. In this design the names are space was designed. In this design the names are defined in an inverted-tree structure with the root at defined in an inverted-tree structure with the root at the top. The tree can have only 128 levels: level 0 the top. The tree can have only 128 levels: level 0 (root) to level 127. (root) to level 127.

Page 32: Application layer

32

Figure 25.2 Domain name space

Page 33: Application layer

33

Figure 25.3 Domain names and labels

Page 34: Application layer

34

Figure 25.8 DNS IN THE INTERNET

Page 35: Application layer

35

DNS: Root name servers contacted by local name server that can not resolve

name root name server:

contacts authoritative name server if name mapping not known

gets mapping returns mapping to local name server

b USC-ISI Marina del Rey, CAl ICANN Marina del Rey, CA

e NASA Mt View, CAf Internet Software C. Palo Alto, CA

i NORDUnet Stockholm

k RIPE London

m WIDE Tokyo

a NSI Herndon, VAc PSInet Herndon, VAd U Maryland College Park, MDg DISA Vienna, VAh ARL Aberdeen, MDj NSI (TBD) Herndon, VA

13 root name servers worldwide

Page 36: Application layer

36

TLD and Authoritative Servers Top-level domain (TLD) servers:

responsible for com, org, net, edu, etc, and all top-level country domains uk, fr, ca, jp.Network solutions maintains servers for com

TLDEducause for edu TLD

Authoritative DNS servers: organization’s DNS servers, providing authoritative hostname to IP mappings for organization’s servers (e.g., Web and mail).Can be maintained by organization or service

provider

Page 37: Application layer

37

Local Name Server

Does not strictly belong to hierarchy

Each ISP (residential ISP, company, university) has one.Also called “default name server”

When a host makes a DNS query, query is sent to its local DNS serverActs as a proxy, forwards query into

hierarchy.

Page 38: Application layer

38

requesting hostcis.poly.edu

gaia.cs.umass.edu

root DNS server

local DNS serverdns.poly.edu

1

23

4

5

6

authoritative DNS serverdns.cs.umass.edu

78

TLD DNS server

Example

Host at cis.poly.edu wants IP address for gaia.cs.umass.edu

Page 39: Application layer

39

requesting hostcis.poly.edu

gaia.cs.umass.edu

root DNS server

local DNS serverdns.poly.edu

1

2

45

6

authoritative DNS serverdns.cs.umass.edu

7

8

TLD DNS server

3

Recursive queries

recursive query: puts burden of

name resolution on contacted name server

heavy load?

iterated query: contacted server

replies with name of server to contact

“I don’t know this name, but ask this server”

Page 40: Application layer

40

Figure 25.12 Recursive resolution

Page 41: Application layer

41

Figure 25.13 Iterative resolution

Page 42: Application layer

42

Figure 25.14 Query and response messages