ali.dmohammadi @gmail.comapplication layer ali.dmohammadi @gmail.comapplication layer 2-1 august 26,...

249
ali.dmohammadi ali.dmohammadi @gmail.com @gmail.com Application Layer Application Layer 2- 2-1 November 2, 2022 . Application Layer Computer Networks Computer Networks Shahrood University of Technology Department of Computer Engineering & IT

Upload: jordan-griffin

Post on 25-Dec-2015

218 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-11April 19, 2023

.

Application Layer

Computer NetworksComputer Networks

Shahrood University of TechnologyDepartment of Computer Engineering & IT

Page 2: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-22April 19, 2023

2.1 Principles of app layer protocols clients and servers app requirements

2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail

SMTP, POP3, IMAP 2.5 DNS

2.6 Socket programming with TCP

2.7 Socket programming with UDP

2.8 Building a Web server

2.9 Content distribution Network Web caching Content distribution

networks P2P file sharing

Chapter 2 OutlineChapter 2 Outline

Page 3: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-33April 19, 2023

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

processes running in different hosts communicate with an application-layer protocol

implements user interface & application-level protocol Web: browser E-mail: mail reader streaming

audio/video: media player

Process: program running within a host.

user agent: interfaces with user “above” and network “below”.

Network ApplicationsNetwork Applications

Page 4: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-44April 19, 2023

Application Program Interface (API)

Communication Software & HardwarePlatform (OS + Hardware)

Application SoftwareApplication Software

(API)(API)

App. SoftwareApp. Software

transportnetwork

linkphysical

application

Controlledby OS

Controlledby App. Soft.

Application-layer protocols:one “piece” of the application; define messages exchanged by apps and actions taken.

Application-layer protocols:one “piece” of the application; define messages exchanged by apps and actions taken.

the application

From Application ViewpointFrom Application Viewpoint

Page 5: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-55April 19, 2023

Application process

Application process

Application Program Interface (API) Application Program Interface (API)

Communication Software & HardwareCommunication Software & Hardware

CommunicationCommunicationNetworkNetwork

Platform (OS + Hardware) Platform (OS + Hardware)

Application Process(Client Side)

Application Process(Client Side)

Application Process(Server Side)

Application Process(Server Side)

Server Agents Examples: Internet Information

Sever, Appachi SQL query engines

Communication Software Examples: TCP, UDP; IP…

Client/Server ApplicationsClient/Server Applications

Page 6: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-66April 19, 2023

application

transportnetworkdata linkphysical

modem

modem

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

Application: communicating, distributed processes

e.g., e-mail, Web, P2P file sharing, instant messaging

running in end systems (hosts)

exchange messages to implement application

Application-layer protocols one “piece” of an app define messages

exchanged by apps and actions taken

use communication services provided by lower layer protocols (TCP, UDP)

Applications and Application-Layer ProtocolsApplications and Application-Layer Protocols

Page 7: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-77April 19, 2023

Types of messages exchanged: request & response messages

Syntax of message types: what fields in messages & how fields are delineated

Semantics of the fields: meaning of information in fields

Rules for when and how processes send & respond to messages

Types of messages exchanged: request & response messages

Syntax of message types: what fields in messages & how fields are delineated

Semantics of the fields: meaning of information in fields

Rules for when and how processes send & respond to messages

Public-domain protocols:

defined in RFCs allows for

interoperability eg, HTTP, SMTP

Proprietary protocols: eg, Napster, KaZaA,

Application-Layer ProtocolsApplication-Layer Protocols

Page 8: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-88April 19, 2023

modem

modem

Typical network app has two pieces: client and server

Client: initiates contact with server

(“speaks first”) typically requests service

from server, Web: client implemented in

browser; e-mail: in mail reader

replyServer: provides requested service to client e.g., Web server sends requested

Web page, mail server delivers e-mail

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

request

Client-Server ParadigmClient-Server Paradigm

Page 9: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-99April 19, 2023

Pure P2P architecturePure P2P architecture

no always on server arbitrary end systems directly communicate peers are intermittently connected and change

IP addresses example: Gnutella

Highly scalable But difficult to manage

modem

modem

Page 10: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-1010April 19, 2023

Hybrid of client-server and P2PHybrid of client-server and P2P

Napster File transfer P2P File search centralized:

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

Instant messaging Chatting between two users is P2P Presence detection/location centralized:

User registers its IP address with central server when it comes online

User contacts central server to find IP addresses of buddies

Page 11: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-1111April 19, 2023

process sends/receives messages to/from its socket

socket analogous to door sending process pushes

message out door sending process assumes

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

process

TCP withbuffers,variables

socket

host orserver

process

TCP withbuffers,variables

socket

host orserver

Internet

controlledby OS

controlled byapp developer

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

Processes Communicating Across NetworkProcesses Communicating Across NetworkSockets: doors between process and hostSockets: doors between process and host

Page 12: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-1212April 19, 2023

For a process to receive messages, it must have an identifier

Every host has a unique 32-bit IP address

Q: 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 host

For a process to receive messages, it must have an identifier

Every host has a unique 32-bit IP address

Q: 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 host

Identifier includes both the IP address and port numbers associated with the process on the host.

Example port numbers: HTTP server: 80 Mail server: 25

Example IP address: 113.45.12.201

Example Identifier: (80; 113.45.12.201)

Process IdentifierProcess Identifier

Page 13: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-1313April 19, 2023

Data loss some apps (e.g., audio)

can tolerate some loss other apps (e.g., file

transfer, telnet) require 100% reliable data transfer

Timing some apps (e.g.,

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

Throughput some apps (e.g.,

multimedia) require minimum amount of bandwidth to be “effective”

other apps (“elastic apps”) make use of whatever bandwidth they get

What transport service does an app need?What transport service does an app need?

Page 14: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-1414April 19, 2023

Application Data loss

Throughput Time Sensitive

file transfer no loss elastic no

e-mail no loss elastic no

web documents

no loss elastic (few kbps) no

real-time audio/video

loss-tolerant

audio: few kbps-1Mbps

video:10kbps-5Mbps

yes, 100s of msec

stored audio/video

loss-tolerant

same as above yes, few sec

interactive games

loss-tolerant

few kbps-10kbps yes, 100s of msec

instant messaging

no loss elastic yes and no

Requirements of Selected Network ApplicationsRequirements of Selected Network Applications

Page 15: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-1515April 19, 2023

TCP 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

no guarantee on: timing, minimum bandwidth

UDP service: unreliable data transfer

between sending and receiving process

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

Q: Why is there a UDP?

Internet Transport Protocols ServicesInternet Transport Protocols Services

Page 16: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-1616April 19, 2023

Internet apps: application, transport protocolsInternet apps: application, transport protocols

applications application-layer protocol

underlying transport protocol

e-mail SMTP [RFC 2821] TCP

remote terminal access

Telnet [RFC 854] TCP

web HTTP [RFC 2616] TCP

file transfer FTP [RFC 959] TCP

remote file server NFS [McKusik] UDP or TCP

streaming multimedia proprietary(e.g., Dialpad)

UDP or TCP

internet telephony proprietary(e.g., Dialpad)

Typically UDP

Page 17: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-1717April 19, 2023

2.1 Principles of app layer protocols clients and servers app requirements

2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail

SMTP, POP3, IMAP 2.5 DNS

2.6 Socket programming with TCP

2.7 Socket programming with UDP

2.8 Building a Web server

2.9 Content distribution Network Web caching Content distribution

networks P2P file sharing

Chapter 2 OutlineChapter 2 Outline

Page 18: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-1818April 19, 2023

What is a Web BrowserWhat is a Web Browser

It is a software application that enables a user to display and interact with html, text, images, audio, and other information typically located on a web page at a web server.

Text and images on a web page can contain hyperlinks to other web pages at the same or different websites.

Web browsers allow a user to quickly and easily access information provided on many web pages at many websites by traversing these links.

Web browser hides http underneath a nice GUI.

Browser must handle server error messages in some elegant way.

Page 19: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-1919April 19, 2023

Web BrowsersWeb Browsers

Deepnet Explorer

Internet Expolrer

Mozilla Firefox

Netscape

Opera

Safari RSS

Page 20: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-2020April 19, 2023

What is a Web Server?What is a Web Server?

The term Web server can mean one of two things:

A computer or A program that is: responsible for accepting HTTP requests from

clients, which are known as Web browsers, and serving them HTTP responses along with optional data contents, which usually are Web pages such as HTML documents and linked objects (images, etc.).

The term Web server can mean one of two things:

A computer or A program that is: responsible for accepting HTTP requests from

clients, which are known as Web browsers, and serving them HTTP responses along with optional data contents, which usually are Web pages such as HTML documents and linked objects (images, etc.).

Page 21: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-2121April 19, 2023

Modern Web ServersModern Web Servers

On client side, higher-end client capabilities: Java applets DHTML (css, xml, javascript, etc). Increased form support in http multimedia (flash, etc.)

On client side, higher-end client capabilities: Java applets DHTML (css, xml, javascript, etc). Increased form support in http multimedia (flash, etc.)

On server side, this led to: dynamic web pages – asp, jsp, servlets, Cold Fusion,

PHP, etc. improvements in cgi

On server side, this led to: dynamic web pages – asp, jsp, servlets, Cold Fusion,

PHP, etc. improvements in cgi

Page 22: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-2222April 19, 2023

Market Share for Top Servers Across All Domains Market Share for Top Servers Across All Domains

Source: http://news.netcraft.com/

Page 23: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-2323April 19, 2023

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:

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.shahroodut.ac.ir/computer/home.html

host name path name

Web and HTTPWeb and HTTP

Page 24: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-2424April 19, 2023

HTTP: hypertext transfer protocol

Web’s app 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 response

Storagecontents:base files, objects

HTTP OverviewHTTP Overview

Page 25: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-2525April 19, 2023

Uses TCP: client initiates TCP

connection (creates socket) to server, port 80

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

Uses TCP: client initiates TCP

connection (creates socket) to server, port 80

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

Protocols that maintain “state” are complex!

past history (state) must be maintained

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

aside

HTTP Overview (cont.)HTTP Overview (cont.)

Page 26: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-2626April 19, 2023

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

HTTP ConnectionsHTTP Connections

Page 27: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-2727April 19, 2023

Suppose user enters URL www.shahroodut.ac.ir/computer/home.html

Suppose user enters URL www.shahroodut.ac.ir/computer/home.html

1. HTTP client initiates TCP connection to HTTP server (process) at www.shahroodut.ac.ir on port 80

3. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object Computer//home.html

2. HTTP server at host www.shahroodut.ac.ir waiting for TCP connection at port 80. “accepts” connection, notifying client

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

(contains text, references to 10

jpeg images)

(contains text, references to 10

jpeg images)

Non-persistent HTTPNon-persistent HTTP

Page 28: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-2828April 19, 2023

5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects

7. Steps 1-6 repeated for each of 10 jpeg objects

6. HTTP server closes TCP connection.

time

4. …

Non-persistent HTTP (cont.)Non-persistent HTTP (cont.)

Page 29: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-2929April 19, 2023

Definition of RTT: time to send a small packet to travel from client to server and back.

Response time: one RTT to initiate TCP

connection one RTT for HTTP

request and first few bytes of HTTP response to return

file transmission timetotal = 2RTT+transmit

time

time to transmit file

initiate TCPconnection

RTT

requestfile

RTT

filereceived

time time

Response Time ModelingResponse Time Modeling

Page 30: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-3030April 19, 2023

Nonpersistent HTTP issues: requires 2 RTTs per object OS must work and allocate

host resources for each TCP connection

but browsers often open parallel TCP connections to fetch referenced objects

Persistent HTTP server leaves connection

open after sending response

subsequent HTTP messages between same client/server are sent over connection

Nonpersistent HTTP issues: requires 2 RTTs per object OS must work and allocate

host resources for each TCP connection

but browsers often open parallel TCP connections to fetch referenced objects

Persistent HTTP server leaves connection

open after sending response

subsequent HTTP messages between same client/server are sent over connection

Persistent without pipelining: client issues new request

only when previous response has been received

one RTT for each referenced object

Persistent with pipelining: default in HTTP/1.1 client sends requests as

soon as it encounters a referenced object

as little as one RTT for all the referenced objects

Persistent HTTPPersistent HTTP

Page 31: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-3131April 19, 2023

method

SP URL SP versionCR

LFheader field name : valu

eCR LF

--- - --- --- ---

header field name : value

CR LFCR

LF

request line

header lines

Entity Body

HTTP HTTP RequestRequest Message: General Format Message: General Format

Page 32: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-3232April 19, 2023

version SPstatus code

SP phrase CR LFheader field name : valu

eCR LF

--- - --- --- ---

header field name : value

CR LFCR

LF

status line

header lines

Entity Body

HTTP HTTP ResponseResponse Message: General Format Message: General Format

Page 33: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-3333April 19, 2023

HTTP request message: ASCII (human-readable format)

GET /somedir/page.html HTTP/1.1Host: www.someschool.edu User-agent: Mozilla/4.0Connection: close Accept-language:frIf-modified-since:Sat, 2 Nov 2002 13:45:12 (carriage return, line feed)

request line(GET, POST,

HEAD commands)

header lines

Carriage return, line feed

indicates end of message

HTTP HTTP RequestRequest Message Message

Page 34: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-3434April 19, 2023

HTTP/1.1 200 OK 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 data data data data data ...

status line(protocol

status codestatus phrase)

header lines

data, e.g., requestedHTML file

MIME lines

HTTP HTTP ResponseResponse Message Message

Page 35: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-3535April 19, 2023

GETGETThe GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URL.

The semantics of the GET method changes to a "conditional GET" if the request message includes an If-Modified-Since header field.

HEADHEADThe HEAD method is identical to GET except that the server must not return any Entity-Body in the response.

There is no"conditional HEAD"request analogous to the conditional GET.

GET and HEAD CommandsGET and HEAD Commands

Page 36: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-3636April 19, 2023

Goal: don’t send object if client has up-to-date

cached version client: specify date of

cached copy in HTTP requestIf-modified-since: <date>

server: response contains no object if cached copy is up-to-date:HTTP/1.0 304 Not Modified

client server

HTTP request msgIf-modified-since:

<date>

HTTP responseHTTP/1.0

304 Not Modified

object not

modified

HTTP request msgIf-modified-since:

<date>

HTTP responseHTTP/1.0 200 OK

<data>

object modified

Conditional GET: Client-Side CachingConditional GET: Client-Side Caching

Page 37: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-3737April 19, 2023

POSTPOST

The POST method is used to request that the destination server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URL in the Request-Line. POST is designed to allow a uniform method to cover the following functions:

Annotation of existing resources;

Posting a message to a bulletin board, newsgroup, mailing list,or similar group of articles;

Providing a block of data, such as the result of submitting a form, to a data-handling process;

Extending a database through an append operation.

POST CommandPOST Command

Page 38: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-3838April 19, 2023

Get method: Web page often

includes form input Input is uploaded to

server in URL field of request line:

Post method: Web page often

includes form input Input is uploaded to

server in entity body

www.somesite.com/cgi.bin/form.cgi?firstname=ali&lastnme=doostmohammadi

URL Encoded data

URL encodingA-Z A-Za-z a-z0-9 0-9

*-_ *-_Space +Others %HEX

Uploading Form InputUploading Form Input

Page 39: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-3939April 19, 2023

HTTP/1.0 GET POST HEAD

asks server to leave requested object out of response

HTTP/1.1 GET, POST, HEAD PUT

uploads file in entity body to path specified in URL field

DELETE deletes file specified

in the URL field

Other Methods

OPTIONS, PATCH, COPY, MOVE, DELETE, LINK, UNLINK, TRACE, WRAPPED, extension method.

Other Methods

OPTIONS, PATCH, COPY, MOVE, DELETE, LINK, UNLINK, TRACE, WRAPPED, extension method.

Method TypesMethod Types

Page 40: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-4040April 19, 2023

1. General Header Fields

2. Request Header Fields

3. Response Header Fields

4. Entity Body Header Fields

1. General Header Fields

2. Request Header Fields

3. Response Header Fields

4. Entity Body Header Fields

Header FieldsHeader Fields

Page 41: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-4141April 19, 2023

1. General Header Fields

Keep-Alive

Upgrade

Connection

Forwarded

Cache-Control

MIME-Version

Data

PragmaTypeApplication

TextImageAudioMultipartVideo

Subtypes Postscript, msword, Msexel,… Html, plain(ASCII),… Jpeg, gif, ief,… Basic, x-pn-realaudio,… mixed mpeg,quicktime

Multipurpose Internet Mail Extensions(rfcs822obs, 2045, 2046, 2077)

Multipurpose Internet Mail Extensions(rfcs822obs, 2045, 2046, 2077)

Header FieldsHeader Fields

Page 42: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-4242April 19, 2023

2. Request Header Fields Accept: Accept-Language: Authorization: From: Host: If-Modified-Since: Proxy-Authorization:

Range: Refer: Unless: User-Agent: Accept-Encoding: Cookie:

Header FieldsHeader Fields

Page 43: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-4343April 19, 2023

3. Response Header Fields

Location:

Proxy-Authentication:

Public:

Retry-After:

Server:

WWW-Authenticate:

Set-Cookie:

3. Response Header Fields

Location:

Proxy-Authentication:

Public:

Retry-After:

Server:

WWW-Authenticate:

Set-Cookie:

Header FieldsHeader Fields

Page 44: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-4444April 19, 2023

4. Entity Body Header Fields Allow Content-EncodingContent-Language Content-Length Content-RangeContent-TypeContent-Version Content-MD5

Derived-From Expires Last-Modified Link Title Transfer-Encoding URL-Header extension-header

Header Fields (cont.)Header Fields (cont.)

Page 45: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-4545April 19, 2023

200 OK request succeeded, requested object later in this

message

301 Moved Permanently requested object moved, new location specified later in

this message (Location:)

400 Bad Request request message not understood by server

404 Not Found requested document not found on this server

200 OK request succeeded, requested object later in this

message

301 Moved Permanently requested object moved, new location specified later in

this message (Location:)

400 Bad Request request message not understood by server

404 Not Found requested document not found on this server

In first line in server -> client response message.

A few sample codes:

In first line in server -> client response message.

A few sample codes:

HTTP Response Status CodesHTTP Response Status Codes

Page 46: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-4646April 19, 2023

Status Codes CategoriesStatus Codes Categories

Response Categories Informational :1xx Successful :2xx Redirection :3xx Client Error :4xx (eg. 404 Not found) Server Error :5xx

Page 47: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-4747April 19, 2023

Status-Codes "201" ; Created "202" ; Accepted "204" ; No Content "301" ; Moved Permanently "200" ; OK "302" ; Moved Temporarily "304" ; Not Modified "400" ; Bad Request "401" ; Unauthorized "403" ; Forbidden "404" ; Not Found "500" ; Internal Server Error "501" ; Not Implemented "502" ; Bad Gateway "503" ; Service Unavailable “505” ; HTTP Version Not Supported

Status-Codes "201" ; Created "202" ; Accepted "204" ; No Content "301" ; Moved Permanently "200" ; OK "302" ; Moved Temporarily "304" ; Not Modified "400" ; Bad Request "401" ; Unauthorized "403" ; Forbidden "404" ; Not Found "500" ; Internal Server Error "501" ; Not Implemented "502" ; Bad Gateway "503" ; Service Unavailable “505” ; HTTP Version Not Supported

Status CodesStatus Codes

Page 48: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-4949April 19, 2023

Authorization : control access to server content

authorization credentials: typically name, password

stateless: client must present authorization in each request

authorization: header line in each request

if no authorization: header, server refuses access, sendsWWW authenticate:

header line in response

client server

usual http request msg401: authorization req.

WWW authenticate:

usual http request msg

+ Authorization: <cred>usual http response

msg

usual http request msg

+ Authorization: <cred>usual http response

msg

time

User-Server Interaction: AuthorizationUser-Server Interaction: Authorization

Page 49: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-5050April 19, 2023

Cookies: Keeping “State”-RFC2109Cookies: Keeping “State”-RFC2109

Some Web sites store information in a small text file on your computer. This file is called a cookie.

There are several types of cookies,

you can choose whether to allow some, none, or all of them to be saved on your computer.

If you do not allow cookies at all, you may not be able to

view some Web sites or take advantage of customization features (such as local

news and weather, or stock quotes).

Page 50: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-5151April 19, 2023

How cookies are usedHow cookies are used

Created by an Internet site to store information on your computer.

Example, you visit a Web site, it saves a record of the pages you looked at, to help the site customize the view for you the next time you visit.

Cookies can also store personally identifiable information, that can be used to identify or contact you, such as

your name, e-mail address, or telephone number. A Web site only has access to the information you provide.

Once a cookie is saved on your computer, only the Web site that created the cookie can read it.

Page 51: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-5252April 19, 2023

Persistent/Temporary CookiesPersistent/Temporary Cookies

A persistent cookie is one stored as a file on your computer, and it remains there when you close Internet browser.

A temporary or session cookie is stored only for your current browsing session, and is deleted from your computer when you close Internet browser.

Page 52: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-5353April 19, 2023

First-Party vs. Third-Party cookiesFirst-Party vs. Third-Party cookies

A first-party cookie either originates on or is sent to the Web site you are currently viewing.

A third-party cookie either originates on or is sent to a Web site different from the one you are currently viewing.

Third-party Web sites usually provide some content on the Web site you are viewing. For example, many sites use advertising from third-party Web sites and those third-party Web sites may use cookies.

A common use for this type of cookie is to track your Web page use for advertising or other marketing purposes.

Third-party cookies can either be persistent or temporary.

Page 53: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-5454April 19, 2023

Unsatisfactory CookiesUnsatisfactory Cookies

Unsatisfactory cookies are cookies that might allow access to personally identifiable information that could be used for a secondary purpose

without your consent.

Unsatisfactory cookies are cookies that might allow access to personally identifiable information that could be used for a secondary purpose

without your consent.

Page 54: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-5656April 19, 2023

There are four components:1) cookie header line in the

HTTP response message2) cookie header line in

HTTP request message3) cookie file kept on user’s

host and managed by user’s browser

4) back-end database at Web site

There are four components:1) cookie header line in the

HTTP response message2) cookie header line in

HTTP request message3) cookie file kept on user’s

host and managed by user’s browser

4) back-end database at Web site

Example: Ali access Internet

always from same PC He visits a specific e-

commerce site for first time

When initial HTTP requests arrives at site, site creates a unique ID and creates an entry in backend database for ID

Many major Web sites use cookiesMany major Web sites use cookies

HTTP and CookiesHTTP and Cookies

Page 55: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-5757April 19, 2023

client server

usual http request msgusual http response

+Set-cookie: 1678

usual http request msg

cookie: 1678usual http response

msg

usual http request msg

cookie: 1678usual http response msg

cookie-specificaction

cookie-specificaction

servercreates ID

1678 for user

entry in backend

database

access

acce

ss

Cookie file

amazon: 1678ebay: 8734

Cookie file

ebay: 8734

Cookie file

amazon: 1678ebay: 8734

one week later:

ExampleExample

Cookie File Samples

Page 56: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-5858April 19, 2023

HTTP

TCP

IP

Routers

Files

packetspacketspacketspacketspacketspackets

Routers

HTTP over TCPHTTP over TCP

Page 57: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-5959April 19, 2023

2.1 Principles of app layer protocols clients and servers app requirements

2.2 Web and HTTP

2.3 FTP 2.4 Electronic Mail

SMTP, POP3, IMAP 2.5 DNS

2.6 Socket programming with TCP

2.7 Socket programming with UDP

2.8 Building a Web server

2.9 Content distribution Network Web caching Content distribution

networks P2P file sharing

Chapter 2 OutlineChapter 2 Outline

Page 58: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-6060April 19, 2023

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

FTP: the File Transfer ProtocolFTP: the File Transfer Protocol

Page 59: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-6161April 19, 2023

File Transfer and Access Protocols (FTP, TFTP, SFTP, NFS) RFCs1

2640 –Internationalization of the File Transfer Protocol

2624 –NFS Version 4 Design Considerations

2623 –NFS Version 2 and Version 3 Security Issues and the NFS Protocol’s Use of RPCSEC_GSS and Kerberos V5

2577 –FTP Security Considerations

Page 60: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-6262April 19, 2023

File Transfer and Access Protocols (FTP, TFTP, SFTP, NFS) RFCs1

2428 –FTP Extensions for IPv6 and NATs

2389 –Feature negotiation mechanism for the File Transfer Protocol

2349, 1784 - TFTP Timeout Interval and Transfer Size Options

2348, 1783 - TFTP Blocksize Option

Page 61: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-6363April 19, 2023

File Transfer and Access Protocols (FTP, TFTP, SFTP, NFS) RFCs2

2347, 1782 - TFTP Option Extension

2228 –FTP Security Extensions

2224 –NFS URL Scheme

2204 –ODETTE File Transfer Protocol

2090 –TFTP Multicast Option

2055 –WebNFS Server Specification

2054 –WebNFS Client Specification

Page 62: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-6464April 19, 2023

File Transfer and Access Protocols (FTP, TFTP, SFTP, NFS) RFCs3

1986 –Experiments with a Simple File Transfer Protocol for Radio Links usingEnhanced Trivial File Transfer Protocol (ETFTP)

1813 –NFS Version 3 Protocol Specification

1785 –TFTP Option Negotiation Analysis

1639, 1545 - FTP Operation Over Big Address Records (FOOBAR)

1635 –How to Use Anonymous FTP

1579 –Firewall-Friendly FTP

Page 63: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-6565April 19, 2023

File Transfer and Access Protocols (FTP, TFTP, SFTP, NFS) RFCs4

1440 –SIFT/UFT: Sender-Initiated/Unsolicited File Transfer

1415 –FTP-FTAM Gateway Specification 1350, 783 - The TFTP Protocol (Revision 2) 1282, 1258 - BSD Rlogin 1235 –Coherent File Distribution Protocol 1094 –NFS: Network File System Protocol

specification 1068 –Background File Transfer Program (BFTP) 1037 –NFILE - a file access protocol

Page 64: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-6666April 19, 2023

File Transfer and Access Protocols (FTP, TFTP, SFTP, NFS) RFCs5

959, 765, 542, 354, 265, 172, 114 - File Transfer Protocol.

949 – FTP unique-named store command. 913 – Simple File Transfer Protocol. 906 – Bootstrap loading using TFTP. 775 – Directory oriented FTP commands. 743 – FTP extension: XRSQ/XRCP. 737 – FTP extension: XSEN.

Page 65: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-6767April 19, 2023

File Transfer and Access Protocols (FTP, TFTP, SFTP, NFS) RFCs6

697 – CWD command of FTP 691 – One more try on the FTP 686 – Leaving well enough alone 683 – FTPSRV - Tenex extension for paged files 662 – Performance improvement in ARPANET

file transfers from Multics 640 – Revised FTP reply codes 630 – FTP error code usage for more reliable

mail service

Page 66: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-6868April 19, 2023

File Transfer and Access Protocols (FTP, TFTP, SFTP, NFS) RFCs7

624 – Comments on the File Transfer Protocol 614 – Response to RFC 607: "Comments on

the File Transfer Protocol" 607 – Comments on the File Transfer Protocol 571 – Tenex FTP problem 535 – Comments on File Access Protocol 532 – UCSD-CC Server-FTP facility 520 – Memo to FTP group: Proposal for File

Access Protocol

Page 67: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-6969April 19, 2023

File Transfer and Access Protocols (FTP, TFTP, SFTP, NFS) RFCs8

506 – FTP command naming problem 505 – Two solutions to a file transfer access

problem 501 – Un-muddling "free file transfer" 487 –

Free file transfer 486 – Data transfer revisited 480 – Host-dependent FTP parameters 479 – Use of FTP by the NIC Journal 478 – FTP server-server interaction - II

Page 68: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-7070April 19, 2023

File Transfer and Access Protocols (FTP, TFTP, SFTP, NFS) RFCs9

468 – FTP data compression 463 – FTP comments and response to RFC 430 448 – Print files in FTP 438 – FTP server-server interaction 430 – Comments on File Transfer Protocol 418 – Server file transfer under TSS/360 at

NASA Ames 414 – File Transfer Protocol (FTP) status and

further comments

Page 69: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-7171April 19, 2023

File Transfer and Access Protocols (FTP, TFTP, SFTP, NFS) RFCs10

412 – User FTP Documentation 385 – Comments on the File Transfer Protocol 310 – Another Look at Data and File Transfer

Protocols 294 – The Use of "Set Data Type" Transaction

in File Transfer Protocol 281 – Suggested addition to File Transfer

Protocol 269 – Some Experience with File Transfer 264, 171 - The Data Transfer Protocol

Page 70: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-7272April 19, 2023

File Transfer and Access Protocols (FTP, TFTP, SFTP, NFS) RFCs11

250 – Some thoughts on file transfer 242 – Data Descriptive Language for Shared

Data 238 – Comments on DTP and FTP proposals 163 – Data transfer protocols 141 – Comments on RFC 114: A File Transfer

Protocol 133 – File Transfer and Recovery

Page 71: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-7373April 19, 2023

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

Client obtains authorization over control connection.

Client browses remote directoryremote directory by sending commands over control connection.

When server receives a command for a file transfer, server opens a TCP data conn. to client at port 20.

FTP clientFTP server

TCP control connectionport 21 (persistent)

TCP data connectionport 20(nonpersistent)

FTP: Separate Control, Data Connections1FTP: Separate Control, Data Connections1

Page 72: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-7474April 19, 2023

USERUSERUSERUSER

FILE SYSTEM

FILE SYSTEM

USERINTERFACE

USERINTERFACE

USERPI

USERPI

USERDTP

USERDTP

SERVERDTP

SERVERDTP

FILESYSTEM

FILESYSTEM

SERVERPI

SERVERPI FTP REPLIESFTP REPLIES

FTP COMMANDSFTP COMMANDS

DATACONNECTION

PI: Protocol InterpreterDTP: Data Transfer Process

FTP MODEL1FTP MODEL1

Page 73: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-7575April 19, 2023

In the model, the user-protocol interpreter (PI) initiates the control connection.

The control connection follows the Telnet protocol.

FTP commands are generated by the user-PI and transmitted to the server process via the control connection.

Standard replies are sent from the server-PI to the user-PI over the control connection in response to the commands.

Control Connection InitiationControl Connection Initiation

Page 74: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-7676April 19, 2023

The FTP commands specify the parameters for the data connection (data port, transfer mode, representation type, and

structure) and the nature of file system operation (store, retrieve,

append, delete, etc.). The user-DTP should "listen" on the specified

data port, and the server initiate the data connection and data transfer in accordance with the specified parameters.

Note that the data connection may be used for simultaneous sending and receiving.

Data Connection InitiationData Connection Initiation

Page 75: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-7878April 19, 2023

After transferring a file, server closes port 20.

Server opens a second TCP data connection to transfer the next file.

Control connection: “out of band” (http is also a file transfer protocol. It is

stateless, in-band and a push/pull protocol. FTP is also a push/pull one)

FTP server maintains “state”: current directory, earlier authentication

FTP: Separate Control, Data ConnectionsFTP: Separate Control, Data Connections

Page 76: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-7979April 19, 2023

Sample commands: sent as ASCII text over

control channel (4 uppercase ASCII characters)

USER username PASS password LIST return list of file in

current directory RETR filename retrieves

(gets) file STOR filename stores

(puts) file onto remote host

Sample return codes status code and phrase

(as in HTTP) 331 Username OK,

password required 125 data connection

already open; transfer starting

425 Can’t open data connection

452 Error writing file

ftp://ftpserver.shahroodut.ac.ir/dir1/filename.extensionftp://ftpserver.shahroodut.ac.ir/dir1/filename.extension

FTP Commands, ResponsesFTP Commands, Responses

Page 77: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-8080April 19, 2023

2.1 Principles of app layer protocols clients and servers app requirements

2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail

SMTP, POP3, IMAP, HTTP

2.5 DNS

2.6 Socket programming with TCP

2.7 Socket programming with UDP

2.8 Building a Web server

2.9 Content distribution Network Web caching Content distribution

networks P2P file sharing

Chapter 2 OutlineChapter 2 Outline

Page 78: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-8181April 19, 2023

Three major components: user agents mail servers simple mail transfer

protocol: SMTP

User Agent Sometimes is called:

“mail reader” composing, editing, reading

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

Netscape Messenger outgoing, incoming

messages stored on server

user mailbox

outgoing message queue

mailserver

useragent

useragent

useragent

mailserver

useragent

useragent

mailserver

useragent

SMTP

SMTP

SM

TP

Electronic MailElectronic Mail

Page 79: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-8282April 19, 2023

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 (sending agent) “server”: receiving mail

server (receiving agent)

mailserver

useragent

useragent

useragent

mailserver

useragent

useragent

mailserver

useragent

SMTP

SMTP

SM

TP

Electronic Mail: Mail ServersElectronic Mail: Mail Servers

Page 80: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-8383April 19, 2023

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

Electronic Mail: SMTP [RFC 2821]Electronic Mail: SMTP [RFC 2821]

Page 81: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-8484April 19, 2023

1) User1 (sender) uses UA to compose message to [email protected] .

2) User1’s UA sends message to his mail server; message placed in message queue.

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

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

5) User2’s mail server places the message in User2’s mailbox.

6) User2 invokes his/her user agent to read message.

UA

: U

ser

Agent

Scenario: User1 sends message to User2Scenario: User1 sends message to User2

useragent

mailserver

mailserver user

agent

1

23 4 5

6User1

User2

[email protected]

[email protected]

webmail.shahroodut.ac.ir

yahoo.com

Page 82: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-8686April 19, 2023

SMTP uses persistent connections.

SMTP requires message (header & body) to be in 7-bit ASCII

SMTP server uses CRLF.CRLF to determine end of message

Comparison with HTTP: HTTP: pull SMTP: push

both have ASCII command/response interaction, status codes.

HTTP: each object encapsulated in its own response message.

SMTP: multiple objects sent in multipart message.

SMTP: Final WordsSMTP: Final Words

Page 83: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-8787April 19, 2023

SMTP: protocol for exchanging email msgs

RFC 822: standard for text message format:

header lines, e.g., To: From: Subject:different from SMTP

commands! body

the “message”, ASCII characters only

header

bodybody

blankline

Mail Message FormatMail Message Format

..

Page 84: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-8888April 19, 2023

Mail

Massage

sms rms: TCP connection establishment on port 25sms rms: SMTP handshake (HELO, MAIL, FROM, RCPT TO, DATA,

commands, and 220, 250, 354, 221 status codes)sms header

<CRLF>body<CRLF>.<CRLF>

sms QUITrms 221 yahoo.com closing connection

SMTP Message Transfer Between Mail ServersSMTP Message Transfer Between Mail Servers

sms = sending mail serverrms = receiving mail server

Page 85: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-8989April 19, 2023

ExampleExample

useragent

mailserver

mailserver user

agent12 3 4 5

6

User1

User2

[email protected]

[email protected]

webmail.shahroodut.ac.ir

yahoo.com

Page 86: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-9090April 19, 2023

Mail Massage

from user1user1 to

user2user2

sms: TCP connection request on port 25rms: 220 yahoo.com accepts connectionsms: HELO webmail.shahroodut.ac.ir is readyrms: 250 Hello webmail.shahroodut.ac.ir sms: MAIL FROM: <[email protected]> rms: 250 [email protected]... Sender ok sms: RCPT TO: <[email protected]> rms: 250 [email protected] ... Recipient ok sms: DATA rms: 354 Enter mail, end with "." on a line by itself sms: From: [email protected] sms: To: [email protected] .

sms: . rms: 250 Message accepted for delivery sms: QUIT rms: 221 yahoo.com closing connection

Example: SMTP InteractionExample: SMTP Interaction

Page 87: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-9191April 19, 2023

MIME: Multipurpose Internet Mail Extension RFC 2045, 2056

additional lines in message header declare MIME content type From: [email protected]

To: [email protected] Subject: Picture of shahroodutcc: [email protected] MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Type: image/jpeg

base64 encoded data ..... ......................... ......base64 encoded data

.

MIME versionMIME version

method usedto encode data

method usedto encode data

multimedia datatype, subtype,

parameter declaration

multimedia datatype, subtype,

parameter declaration

encoded dataencoded data

Message Format: Multimedia ExtensionsMessage Format: Multimedia Extensions

Page 88: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-9292April 19, 2023

Text example subtypes:

plain, html

Image example subtypes: jpeg,

gif

Audio example 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

MIME MIME (RFCs(RFCs2045, , 2046, , 2077)) Types TypesContent-Type: type/subtype; parametersContent-Type: type/subtype; parameters

Page 89: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-9393April 19, 2023

From: [email protected] To: [email protected] Subject: photo of shahroodut. MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=StartOfNextPart --StartOfNextPartDear User1, Hear is a photo of shahroodut in 1388 winter.--StartOfNextPartContent-Transfer-Encoding: base64Content-Type: image/jpegbase64 encoded data ..... ......................... ......base64 encoded data --StartOfNextPartDo you like to receive more pictures?.

Multipart TypeMultipart Type

Page 90: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-9494April 19, 2023

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

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

download IMAP: Internet Mail Access Protocol [RFC 1730]

more features (more complex) manipulation of stored messages on server

HTTP: Hotmail , Yahoo! Mail, Shahroodut, etc.

useragent

sender’s mail server

useragent

SMTP SMTP accessprotocol

receiver’s mail server

Sender Receiver

Mail Access ProtocolsMail Access Protocols

Page 91: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-9595April 19, 2023

RFC 1939 / Std 53 To retrieve emails from server (POP3

server) Server port number: 110

Three states Authorization State Transaction State Update State

POP3-Post Office Protocol - Version 3POP3-Post Office Protocol - Version 3

Page 92: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-9696April 19, 2023

POP3 CommandsPOP3 Commands

Authorization State USER username PASS password APOP name digest

Transaction State STAT LIST [msgNo] RETR msgNo DELE msgNo NOOP RSET TOP msgNo line UIDL [msgNo]

Authorization State USER username PASS password APOP name digest

Transaction State STAT LIST [msgNo] RETR msgNo DELE msgNo NOOP RSET TOP msgNo line UIDL [msgNo]

Update State QUIT

Update State QUIT

Page 93: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-9797April 19, 2023

authorization phase client commands:

user: declare username pass: password

server responses +OK -ERR

transaction phase, client: list: list message

numbers retr: retrieve message by

number dele: delete quit

C: list S: 1 498 S: 2 912 S: . C: retr 1 S: <message 1 contents> S: . C: dele 1 C: retr 2 S: <message 1 contents> S: . C: dele 2 C: quit S: +OK POP3 server signing off

S: +OK POP3 server ready C: user USER1S: +OK C: pass zxcdvf S: +OK user successfully logged on

POP3 ProtocolPOP3 Protocol

Page 94: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-9898April 19, 2023

More about POP3 Previous example uses

“download and delete” mode.

“Download” brings the mail into client computer.

“Delete” removes the mail from the mail server. User1 cannot re-read e-mail if he/she changes client computer.

“Download-and-keep”: leaves the message on the mail server.

POP3 is stateless across sessions.

IMAP Keep all messages in

one place: the server Allows user to

organize messages in folders

IMAP keeps user state across sessions: names of folders and

mappings between message IDs and folder name

POP3 (more) and IMAPPOP3 (more) and IMAP

Page 95: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-9999April 19, 2023

2.1 Principles of app layer protocols clients and servers app requirements

2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail

SMTP, POP3, IMAP, HTTP

2.5 DNS

2.6 Socket programming with TCP

2.7 Socket programming with UDP

2.8 Building a Web server

2.9 Content distribution Network Web caching Content distribution

networks P2P file sharing

Chapter 2 OutlineChapter 2 Outline

Page 96: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-100100April 19, 2023

DNS RFCs1DNS RFCs1

2673 –Binary Labels in the Domain Name System.

2672 –Non-Terminal DNS Name Redirection.

2671 –Extension Mechanisms for DNS (EDNS0).

2606 –Reserved Top Level DNS Names.

2541 –DNS Security Operational Considerations.

2540 –Detached Domain Name System (DNS) Information.

2539 –Storage of Diffie-Hellman Keys in the Domain Name System (DNS).

Page 97: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-101101April 19, 2023

DNS RFCs2DNS RFCs2

2535 –Domain Name System Security Extensions.

2517 –Building Directories from DNS: Experiences from WWWSeeker.

2352, 2240 - A Convention For Using Legal Names as Domain Names.

2317 –Classless IN-ADDR.ARPA delegation.

2308 –Negative Caching of DNS Queries (DNS. NCACHE) 2230 –Key Exchange Delegation Record for the DNS.

2219 –Use of DNS Aliases for Network Services.

2182 –Selection and Operation of Secondary DNS Servers.

Page 98: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-102102April 19, 2023

DNS RFCs3DNS RFCs3

2181 –Clarifications to the DNS Specification.

2137 –Secure Domain Name System Dynamic Update.

2136 –Dynamic Updates in the Domain Name System (DNS UPDATE).

2065 –Domain Name System Security Extensions.

2052 –A DNS RR for specifying the location of services (DNS SRV).

2010 –Operational Criteria for Root Name Servers.

1996 –A Mechanism for Prompt Notification of Zone Changes (DNS NOTIFY).

1995 –Incremental Zone Transfer in DNS.

Page 99: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-103103April 19, 2023

DNS RFCs4DNS RFCs4

1982 –Serial Number Arithmetic. 1912, 1537 - Common DNS Operational and

Configuration Errors. 1876 –A Means for Expressing Location

Information in the Domain Name System. 1794 –DNS Support for Load Balancing. 1713 –Tools for DNS debugging. 1712 –DNS Encoding of Geographical Location. 1706, 1637, 1348 - DNS NSAP Resource

Records. 1591 –Domain Name System Structure and

Delegation.

Page 100: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-104104April 19, 2023

DNS RFCs5DNS RFCs5

1536 –Common DNS Implementation Errors and Suggested Fixes.

1535 –A Security Problem and Proposed Correction With Widely Deployed DNS Software

1480, 1386 - The US Domain. 1464 –Using the Domain Name System To

Store Arbitrary String Attributes. 1394 –Relationship of Telex Answerback Codes

to Internet Domains. 1183 –New DNS RR Definitions. 1101 –DNS encoding of network names and

other types. 1035 –Domain names - implementation and

specification.

Page 101: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-105105April 19, 2023

DNS RFCs6DNS RFCs6

1034 –Domain names - concepts and facilities 1033 –Domain administrators operations guide 1032 –Domain administrators guide 1031 –MILNET name domain transition 973 – Domain system changes and

observations 953, 811 - Hostname Server 921, 897 - Domain name system

implementation schedule - revised 920 – Domain requirements

Page 102: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-106106April 19, 2023

DNS RFCs7DNS RFCs7

883 – Domain names: Implementation specification

882 – Domain names: Concepts and facilities 881 – Domain names plan and schedule 830 – Distributed system for Internet name service 819 – Domain naming convention for Internet user

applications 799 – Internet name domains 756 – NIC name server - a datagram-based

information utility 752 – Universal host table

Page 103: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-107107April 19, 2023

People: many identifiers: SSN, name, passport #

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

used for addressing datagrams

“name”, e.g., www.shahroodut.ac.ir - 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) note: core Internet

function, implemented as application-layer protocol

complexity at network’s “edge”

DNS: Domain Name SystemDNS: Domain Name SystemRFC1034RFC1034

Page 104: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-108108April 19, 2023

Why DNSWhy DNS

Although DNS is most commonly associated with the Internet, private networks also use DNS because of the following benefits:

Convenience: User-friendly names are easier for

people to remember than numerical IP addresses. Consistency: IP addresses may change, but the

server names can remain constant. Simplicity: Users need to learn only one naming

convention to find resources on either the Internet or on an intranet.

Page 105: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-109109April 19, 2023

DNS: Domain Name SystemDNS: Domain Name System

The Domain Name System is a distributed database system that can serve as the foundation for name resolution in a TCP/IP network.

DNS is used by most internetworking software, such as web browsers and electronic mail programs, to locate servers and to resolve, or map, a user-friendly name of a computer to its IP address.

Page 106: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-110110April 19, 2023

DNS ComponentsDNS Components

To understand how DNS maps names to IP addresses, you will need to understand the following five components: 1. Domain Name Space

Name Structure, 2. Zone

Zone data base file, 3. Name Server (DNS Server)

DNS Root Servers, 4. DNS Resolver, 5. Protocol

Forward Lookup Query Caching.

Page 107: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-111111April 19, 2023

1. Domain Name Space1. Domain Name Space

The domain name space has a hierarchical structure.

The root domain is at the top, and it is represented by a period.

Below the root domain, the top-level, or 1st-level domains can be an organizational type, such as com or edu., or a geographic location, such as ir. for IRAN.

Second-level domains are registered to individuals or organizations, such as microsoft.com, the Microsoft Corporation domain.

Second-level domains can have many sub domains. …and any domain can have hosts.

Page 108: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-112112April 19, 2023

1. Domain Name Space1. Domain Name Space

“ .”Root Domain

Top Level or First Level Domain

org. edu. com. ir.

Second Level Domain (Registered to Individuals or Organizations)ac.ir.

sut.ac.ir.

ce.sut.ac.ir.

Any domain can have hosts. A host is a specific computer within a domain. Shahrood University of Technology ‘s Domain: sut.ac.ir.

Any domain can have hosts. A host is a specific computer within a domain. Shahrood University of Technology ‘s Domain: sut.ac.ir.

host

subdomain 2nd-leveldomain

top-leveldomain

webmail . sut . ac . ir .root

fully

qualifi

ed d

om

ain

nam

e, or

FQD

N

Page 109: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-113113April 19, 2023

1. Domain Name Space: Name Structure1. Domain Name Space: Name Structure

Host name . … . Subdomain-name . 2nd-level –name. 1st-level-name .

Max: 255 Characters

Max: 63 Characters

ICANN: Internet Corporation For Assigned Names and Numbers) http://icann.org

Levelm -name authority appoints levelm-1 -names.

Example: ir. is controlled by (فيزيک نظری) shahroodut.ir. is appointed by (فيزيک نظری) and

controlled by Shahrood University of Technology.

Root

Page 110: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-114114April 19, 2023

Names are ValuableNames are Valuable

newnew

Page 111: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-115115April 19, 2023

1. Domain Name Space: Top Levels1. Domain Name Space: Top Levels

com: commercial edu: educational institute ac: Academic, research

institute int: international organization gov: US federal goverment org: US armed forces net: network providers biz: business name: people’s name pro: professions tv: TV stations and networks …

ir: Iran nl: Netherlands jp: Japan uk: England …

ir: Iran nl: Netherlands jp: Japan uk: England …

For the most up-to-date For the most up-to-date information about new top information about new top level domains, consult: level domains, consult: http://www.icann.org/tldshttp://www.icann.org/tlds

For the most up-to-date For the most up-to-date information about new top information about new top level domains, consult: level domains, consult: http://www.icann.org/tldshttp://www.icann.org/tlds

Page 112: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-116116April 19, 2023

For administrative purposes, domains can be organized into zones.

As you can see in this example, a zone is a discrete and contiguous area of the domain name space.

One reason to divide a name space into zones is to delegate authority for different portions of it.

One very large domain could be difficult to administer. The name-to-IP address data for computers located in a

zone, is stored in a zone database file on a DNS name server.

For administrative purposes, domains can be organized into zones.

As you can see in this example, a zone is a discrete and contiguous area of the domain name space.

One reason to divide a name space into zones is to delegate authority for different portions of it.

One very large domain could be difficult to administer. The name-to-IP address data for computers located in a

zone, is stored in a zone database file on a DNS name server.

2. Zones2. Zonesir.

ac.ir.NameServer

NameServer

NameServer

Zone Database File

Zone Database File

Zone Database File

Page 113: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-117117April 19, 2023

A zone database storing resource records (RR) of the zone for which a server is authoritative.

Type=NS name is domain (e.g.

shahroodut.ac.ir) value is IP address of authoritative

name server for this domain

Type=A name is hostname value is IP address

Type=CNAME name is alias name for some

“canonical” (the real) name www.ibm.com is really servereast.backup2.ibm.com value is canonical name

Type=MX value is name of mail-

server associated with name

2. Zone Database File2. Zone Database File

RR format: (Name, TTL, Class, Type, Value)

Page 114: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-118118April 19, 2023

2. Zone Database File: Type Description2. Zone Database File: Type Description

Number

Type Description Example Resource Record Format

1 A Network address www 1D IN A 10.1.1.1

2 NS Authoritative name server

@ 1D IN NS na.av.com

3 MD Mail destination; now replaced by MX

4 MF Mail forwarder; now replaced by MX

5 CNAME Canonical alias name

6 SOA Start of zone authority

7 MB Mailbox domain name

8 MG Mailbox member

9 MR Mail rename domain

10 NULL Null resource record

11 WKS Well-Known service

RR format: (Name, TTL, Class, Type, Value)

Page 115: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-119119April 19, 2023

2. Zone Database File: Type Description2. Zone Database File: Type Description

Number

Type Description Example Record Format

12 PTR Pointer to a domain name

13 HINFO Host information www 1D IN HINFO Solaris

14 MINFO Mailbox information

15 MX Mail exchange

16 TXT Text strings System 1 IN TXT “This is a new system”

17 RP Responsible person

18 AFSDB AFS-type services

19 X.25 X.25 address

20 ISDN ISDN address

21 RT Route through

RR format: (Name, TTL, Class, Type, Value)

Page 116: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-120120April 19, 2023

2. Zone Database File: 2. Zone Database File: ExampleExample

mail.sut.ac.ir 1 D IN HINFO Sun Unix

mail.sut.ac.ir 1 D IN A 130.37.16.112

mail.sut.ac.ir 1 D IN A 192.31.231.165

mail.sut.ac.ir 1 D IN MX 1 mail.sut.ac.ir

mail.sut.ac.ir 1 D IN MX 2 ms.sut.ac.ir

post.sut.ac.ir. 1 D IN CNAME mail.sut.ac.ir

ftp.sut.ac.ir. 1 D IN CNAME file.sut.ac.ir

mail.sut.ac.ir 1 D IN HINFO Sun Unix

mail.sut.ac.ir 1 D IN A 130.37.16.112

mail.sut.ac.ir 1 D IN A 192.31.231.165

mail.sut.ac.ir 1 D IN MX 1 mail.sut.ac.ir

mail.sut.ac.ir 1 D IN MX 2 ms.sut.ac.ir

post.sut.ac.ir. 1 D IN CNAME mail.sut.ac.ir

ftp.sut.ac.ir. 1 D IN CNAME file.sut.ac.ir

NameName TTLTTL ClassClass TypeType ValueValue

Canonical Names Canonical Names Real namesReal names

Primary mail server

Primary mail server

Secondary mail serverSecondary mail server

Host InformationHost Information

Page 117: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-121121April 19, 2023

A DNS server is a computer that runs a DNS server program, such as Berkeley Internet NAME Domain (BIND).

DNS Servers contain DNS database files.

They resolve name resolution queries issued by DNS clients.

Why not centralize DNS? single point of failure traffic volume distant centralized

database maintenance

doesn’t scale!

no server has all name-to-IP address mappings.does scale!

3. DNS Name Servers3. DNS Name Servers

Page 118: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-122122April 19, 2023

Distributed, Hierarchical DatabaseDistributed, Hierarchical Database

Root DNS Servers

org DNS Servers edu DNS Servers com DNS Servers ir DNS Servers

ac.ir DNSServers

shahroodut.ac.irDNS Servers

Page 119: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-123123April 19, 2023

3. DNS Name Servers3. DNS Name Servers

One name server holds the primary zone database file for a zone.

That name server is said to"have authority" for making changes to the zone file.

A copy of the zone file maybe stored on other servers to balance network load.

These copies are referred to as secondary zone database files.

The secondary zone database files are updated regularly from the primary zone database file by a process called zone transfer.

One name server holds the primary zone database file for a zone.

That name server is said to"have authority" for making changes to the zone file.

A copy of the zone file maybe stored on other servers to balance network load.

These copies are referred to as secondary zone database files.

The secondary zone database files are updated regularly from the primary zone database file by a process called zone transfer.

ir.

ac.ir.

NameServer

Secondary Zone Database File

NameServer

Primary Zone Database File

Page 120: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-124124April 19, 2023

Zone Owner’s ResponsibilitiesZone Owner’s Responsibilities

Authoritatively maintain the zone’s data. Arrange for replicated name servers for the

zone Typically, zone data is maintained in a primary file and

loaded into a primary server Replicated servers use TCP-based zone transfers

specified in DNS protocol to refresh their data. Therefore, either servers can answer name resolution

queries for that zone. A name server authoritative for a zone does not

have to be in that zone. A name server can handle any number of zones,

which don’t have to be contiguous.

Page 121: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-125125April 19, 2023

(b)(b) USC-ISI Marina del Rey, CA

(l)(l) ICANN Marina del Rey, CA

(e) (e) NASA Mt View, CA(f)(f) Internet Software C. Palo Alto,

CA

(i)(i) NORDUnet Stockholm, Sweden

(k)(k) RIPE London, UK

(m)(m) WIDE Tokyo, Japan

(a)(a) NSI Herndon, VA(c)(c) PSInet Herndon, VA

(d)(d) U Maryland College Park, MD(g)(g) DISA Vienna, VA

(h)(h) ARL Aberdeen, MD(j)(j) NSI (TBD) Herndon, VA

contacted by local name server that can not resolve name root name server:

Either, contacts authoritative name server gets mapping returns mapping to local name server

Or, introduces authoritative name server to local name server.

13 root name servers worldwide

3. DNS Root Name Servers3. DNS Root Name Servers

Page 122: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-126126April 19, 2023

13 Root Name Servers13 Root Name Servers

F gets 270,000,000+ hits per day. Other root servers are comparable.

Top Level Domain servers answer 5,000,000,000 per day.

F gets 270,000,000+ hits per day. Other root servers are comparable.

Top Level Domain servers answer 5,000,000,000 per day.

Page 123: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-127127April 19, 2023

3. DNS Root Name Servers3. DNS Root Name Servers

Root Servers

Server Operator Locations IP Addr HomeASN

A VeriSign Global Registry Services

Dulles VA 198.41.0.4 19836

B Information Sciences Institute

Marina Del Rey CA IPv4: 192.228.79.201

IPv6: 2001:478:65::53

tba

C Cogent Communications Herndon VA; Los Angeles;

New York City; Chicago 192.33.4.12 2149

D University of Maryland College Park MD 128.8.10.90 27

E NASA Ames Research Center

Mountain View CA 192.203.230.10 297

F Internet Systems Consortium, Inc.

Ottawa; Palo Alto; San Jose CA;New York City; San Francisco;Madrid; Hong Kong; Los Angeles;Rome; Auckland; Sao Paulo; Beijing; Seoul; Moscow; Taipei;Dubai; Paris; Singapore; Brisbane;Toronto; Monterrey; Lisbon; Johannesburg;Tel Aviv;Jakarta; Munich;

IPv4: 192.5.5.241IPv6: 2001:500::1035

3557

G U.S. DOD NetworkInformation Center

Vienna VA 192.112.36.4 568

Page 124: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-128128April 19, 2023

3. DNS Root Name Servers3. DNS Root Name Servers

Root Servers

Server Operator Locations IP Addr Hom

eASN

H U.S. Army Research Lab Aberdeen MD IPv4: 128.63.2.53IPv6:2001:500:1::803f:235

13

I Autonomica/NORDUnet

Stockholm; Helsinki; Milan;London; Geneva; Amsterdam;Oslo; Bangkok; Hong Kong;Brussels; Frankfurt;Bucharest; Ankara;Chicago; Washington DC;Tokyo; Kuala Lumpur

192.36.148.17 29216

J VeriSign Global Registry Services

Dulles VA (2 locations); Mountain View CA;Seattle WA; Amsterdam;Atlanta GA; Los Angeles CA;Miami; Stockholm; London;Tokyo; Seoul; Singapore;Sterling VA (2 locations, standby)

192.58.128.30 26415

K Reseaux IP Europeens -

Network Coordination Centre

London (UK); Amsterdam (NL);Frankfurt (DE); Athens (GR);Doha (QA); Milan (IT)

IPv4: 193.0.14.129IPv6: 2001:7fd::1

25152

L Internet Corporation for

Assigned Names and Numbers

Los Angeles 198.32.64.12 20144

M WIDE Project Tokyo; Seoul (KR); Paris (FR) 202.12.27.33

IPv6: 2001:dc3::35 7500

Page 125: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-129129April 19, 2023

Autonomous SystemAutonomous System

On the Internet, an Autonomous System (AS) is the unit of router policy, Either a single network Or a group of network

that is controlled by a common network administrator (or group of administrators) on behalf of a single administrative entity (such as a university, a business enterprise, or a business division).

An autonomous system is also sometimes referred to as a routing domain.

An autonomous system is assigned a globally unique number, sometimes called an Autonomous System Number (ASN).

Page 126: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-130130April 19, 2023

4. Resolver4. Resolver

A DNS resolver is a service that uses the DNS protocol to query for information from DNS servers.

Function of DNS resolver is performed by the DNS client service.

DNS service uses UDP in transport layer.

Page 127: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-131131April 19, 2023

Root name server: may not know

authoritative name server

may know intermediate name server: who to contact to find authoritative name server

requesting host

www.icann.org

root name server

local name serverdns.shahroodut.ac.ir

1

23

4 5

6

authoritative name serverdns.icann.org

intermediate name server(Top level) dns.org

7

8

5. DNS Protocol: Forward Lookup Query5. DNS Protocol: Forward Lookup Query

a:answerr:referral q:query q

q

q

a

a

a

a

q

Page 128: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-132132April 19, 2023

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”

requesting host

www.icann.org

root name server

local name serverdns.shahroodut.ac.ir

1

23

4

5 6

authoritative name serverdns.icann.org

intermediate name server(Top Level) dns.org

7

8

iterated query

5. DNS Protocol: Forward Lookup Query5. DNS Protocol: Forward Lookup Query

a:answerr:referral q:query

aq

q

q

qa

r

a

Page 129: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-133133April 19, 2023

5. DNS Protocol: Forward Lookup Query5. DNS Protocol: Forward Lookup Query

requesting host

www.icann.org

root name server

local name serverdns.shahroodut.ac.ir

1

23

4

5

6

authoritative name serverdns.icann.org

intermediate name server(Top Level) dns.org

7

8

iterated query

a:answerr:referral q:query

aq

r

q

q

qr

a

Page 130: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-134134April 19, 2023

5. DNS Protocol: Forward Lookup Query5. DNS Protocol: Forward Lookup Query

The query contains the FQDN of the requested computer. A forward lookup query is a request

to map a name to an IP address.

“ .”

org. edu. com. ir.

ac.ir.shahroodut.ac.ir.

LocalName Server

RootName Server

Client

www.icann.org.

Authorized nameserver for org. zone

Forward Lookup Query:What is IP Address of www.icann.org

IP Address of www.icann.org is 142.12.01.23

Page 131: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-135135April 19, 2023

DNS Resolver and Local DNS ServerDNS Resolver and Local DNS Server

Application

DNS resolver

Local DNSserver

1 10

DNS cache

DNS query

2

DNS response 9

Root server

3

4

Top-leveldomain server

5

6

Second-leveldomain server

7

8

Caching based on a time-to-live (TTL) assigned by the DNS server responsible for the host name to reduce latency in DNS translation.

Page 132: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-137137April 19, 2023

DNS protocol : query and reply messages, both with same message format

msg header identification: 16 bit #

for query, reply to query uses same #

flags: query or reply recursion desired recursion available reply is authoritative

5. DNS Protocol Messages5. DNS Protocol Messages

identification flags

number of questions number of answer RRs

number of authority RRs number of additional RRs

questions(variable number of questions)

answers(variable number of resource records)

authority(variable number of resource records)

additional information(variable number of resource records)

12

byte

s

Page 133: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-138138April 19, 2023

identification flags

number of questions number of answer RRs

number of authority RRs number of additional RRs

questions(variable number of questions)

answers(variable number of resource records)

authority(variable number of resource records)

additional information(variable number of resource records)

Name, Type fields for a query

RRs in responseto query

records forauthoritative servers

additional “helpful”info that may be used

5. DNS Protocol Messages5. DNS Protocol Messages12

byte

s

Page 134: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-140140April 19, 2023

Example: Set Debug CommandExample: Set Debug Command

> set debug> www.goole.comServer: jupitr.shahroodut.ac.irAddress: 194.225.228.4-------------------------------Got answer:

HEADER:opcode = QUERY, id = 11, rcode =

NOERRORheader flags: response, want

recursion, recursion avail.questions = 1, answers = 4, authority records = 6, additional = 0

QUESTIONS:www.google.com, type = A, class = IN

ANSEWRS:-> www.google.com

cannonical name = www.1.google.com

ttl = 900 <15 mins>-> www.1.google.com

internet address = 66.102.9.147ttl = 176 <2 mins 56 secs>

-> www.1.google.cominternet address = 66.102.9.99ttl = 176 <2 mins 56 secs>

-> www.1.google.cominternet address = 66.102.9.104ttl = 176 <2 mins 56 secs>

> set debug> www.goole.comServer: jupitr.shahroodut.ac.irAddress: 194.225.228.4-------------------------------Got answer:

HEADER:opcode = QUERY, id = 11, rcode =

NOERRORheader flags: response, want

recursion, recursion avail.questions = 1, answers = 4, authority records = 6, additional = 0

QUESTIONS:www.google.com, type = A, class = IN

ANSEWRS:-> www.google.com

cannonical name = www.1.google.com

ttl = 900 <15 mins>-> www.1.google.com

internet address = 66.102.9.147ttl = 176 <2 mins 56 secs>

-> www.1.google.cominternet address = 66.102.9.99ttl = 176 <2 mins 56 secs>

-> www.1.google.cominternet address = 66.102.9.104ttl = 176 <2 mins 56 secs>

AUTHORITY RECORDS:-> 1.google.com

nameserver = b.1.google.comttl = 37098 <10 hours 18 mins 18

secs>-> 1.google.com

nameserver = c.1.google.comttl = 37098 <10 hours 18 mins 18

secs>-> 1.google.com

nameserver = d.1.google.comttl = 37098 <10 hours 18 mins 18

secs>-> 1.google.com

nameserver = e.1.google.comttl = 37098 <10 hours 18 mins 18

secs>-> 1.google.com

nameserver = g.1.google.comttl = 37098 <10 hours 18 mins 18

secs>-> 1.google.com

nameserver = a.1.google.comttl = 37098 <10 hours 18 mins 18

secs> --------------------Non-authoritative answer:Name: www.1.google.comAddresses: 66.102.9.147, 66.102.9.99, 66.102.9.104Aliases: www.google.com

AUTHORITY RECORDS:-> 1.google.com

nameserver = b.1.google.comttl = 37098 <10 hours 18 mins 18

secs>-> 1.google.com

nameserver = c.1.google.comttl = 37098 <10 hours 18 mins 18

secs>-> 1.google.com

nameserver = d.1.google.comttl = 37098 <10 hours 18 mins 18

secs>-> 1.google.com

nameserver = e.1.google.comttl = 37098 <10 hours 18 mins 18

secs>-> 1.google.com

nameserver = g.1.google.comttl = 37098 <10 hours 18 mins 18

secs>-> 1.google.com

nameserver = a.1.google.comttl = 37098 <10 hours 18 mins 18

secs> --------------------Non-authoritative answer:Name: www.1.google.comAddresses: 66.102.9.147, 66.102.9.99, 66.102.9.104Aliases: www.google.com

Page 135: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-141141April 19, 2023

2.1 Principles of app layer protocols clients and servers app requirements

2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail

SMTP, POP3, IMAP 2.5 DNS

2.6 Socket programming with TCP

2.7 Socket programming with UDP

2.8 Building a Web server

2.9 Content distribution Network Web caching Content distribution

networks P2P file sharing

Chapter 2 OutlineChapter 2 Outline

Page 136: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-142142April 19, 2023

Using Ports to Identify ServicesUsing Ports to Identify Services

Web server(port 80)

Client host

Server host 128.2.194.242

Echo server(port 7)

Service request for128.2.194.242:80

(i.e., the Web server)

Web server(port 80)

Echo server(port 7)

Service request for128.2.194.242:7

(i.e., the echo server)

OS

OS

Client

Client

Client host

Page 137: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-143143April 19, 2023

Network Application-CommunicationNetwork Application-Communication

Network Applications communicates through a network. API is a programming means, either a library or part of

OS. API provides the communication functionality for the

Network Applications (Processes).

Application Program Interface (API)

Communication Software & HardwarePlatform (OS + Hardware)

Application Software(Network Application)Application Software(Network Application)

OSOS

API comes as a library

Page 138: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-144144April 19, 2023

API TechnologiesAPI Technologies-Sockets-Sockets

Sockets (earliest technology) Low level functions for the

communication Socket, ServerSocket, ConnectionSocket, ClientSocket, DatagramSocket, Send, Read, Write, Close, Accept

Page 139: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-145145April 19, 2023

API TechnologiesAPI Technologies-RPC-RPC Remote Procedure Call (RPC)

Client code invokes a procedure on a remote server. RPCs support a wire format common to all platforms. Client and server translate from their binary

format into the wire format. Each RPC involves four translation:

Client to wire format, Wire to server format, Server back to wire (for the return value), Wire format back to client format.

Page 140: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-146146April 19, 2023

API TechnologiesAPI Technologies-Components-Components

Components: Components Look and act like objects, CORBA (common object request Broker

Architecture) COM, COM+ , DCOM (Distributed Component Object

Model)

Page 141: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-147147April 19, 2023

Socket API introduced in BSD4.1

UNIX, 1981 explicitly created, used,

released by apps client/server paradigm two types of transport

service via socket API: unreliable datagram reliable, byte stream-

oriented

Socket API introduced in BSD4.1

UNIX, 1981 explicitly created, used,

released by apps client/server paradigm two types of transport

service via socket API: unreliable datagram reliable, byte stream-

oriented

Goal:Goal: learn how to build client/server application learn how to build client/server application that communicate using socketsthat communicate using sockets

Socket ProgrammingSocket Programming

Socket a host-local, application-

created, OS-controlled interface

a “door” into which application process can both send and receive

messages to/from another application process

Socket a host-local, application-

created, OS-controlled interface

a “door” into which application process can both send and receive

messages to/from another application process

Page 142: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-148148April 19, 2023

Socket: a door between application process and end-end-transport protocol (UDP or TCP)

TCP service: reliable transfer of bytes from one process to another

process

socketsocket

controlled byapplicationdeveloper

controlled byoperating

system

client or server

process

socketsocket

controlled byapplicationdeveloper

controlled byoperatingsystem

client or server

NetworkTCP withTCP withbuffers,buffers,

variablesvariables

TCP withTCP withbuffers,buffers,

variablesvariables

Socket Programming Using TCPSocket Programming Using TCP

Page 143: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-149149April 19, 2023

Client must contact server server process must first

be running server must have created

socket (door) that welcomes client’s contact

Client contacts server by: creating client-local TCP

socket specifying IP address, port

number of server process When client creates

socket: client TCP establishes connection to server TCP

When contacted by client, server TCP creates new socket for server process to communicate with client allows server to talk

with multiple clients source port numbers

used to distinguish clients (more in Chap 3)

TCP provides reliable, in-order transfer of bytes (“pipe”) between client and server

application viewpoint

Socket Programming Socket Programming with TCPwith TCP

Page 144: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-150150April 19, 2023

SocketsSockets

ClientsocketClient

socketConnectionsocketConnectionsocket

WelcomingsocketWelcomingsocket

Three-way handshake

Client processClient process Server processServer process

Client IP Address&

Port Number

Server IP Address&

Port Number2

Server IP Address&

Port Number1

bytes

send read read write

Page 145: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-151151April 19, 2023

1) Example client-server app. in Java:2) Client

1) reads line from standard input (keyboard) (inFromUser stream)

2) sends to server via socket (outToServer stream)

3) Server 1) reads line from socket2) converts line to uppercase, 3) sends back to client

4) Client 1) reads (inFromServer stream), 2) prints modified line from socket on its standard output

(monitor)

1) Example client-server app. in Java:2) Client

1) reads line from standard input (keyboard) (inFromUser stream)

2) sends to server via socket (outToServer stream)

3) Server 1) reads line from socket2) converts line to uppercase, 3) sends back to client

4) Client 1) reads (inFromServer stream), 2) prints modified line from socket on its standard output

(monitor)

Example: Socket Programming with TCPExample: Socket Programming with TCP

Page 146: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-152152April 19, 2023

Example: 3 streams and 1 socketExample: 3 streams and 1 socket

ClientProcess

ClientProcess

ClientSocketClientSocket

ou

tTO

Serv

ero

utT

OS

erv

er

inFo

rmU

serin

Form

Use

r

inFo

rmServ

erin

Form

Serv

er

InputStream

OutputStream

InputStream

TCP socket

To transport layerFrom transport layer

Page 147: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-153153April 19, 2023

A stream is a sequence of characters that flow into or out of a process.

An input stream is attached to some input source for the process, eg, keyboard or socket.

An output stream is attached to an output source, eg, monitor or socket.

StreamsStreams

Page 148: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-154154April 19, 2023

wait for incomingconnection requestconnectionSocket =welcomeSocket.accept()

create socket,port=x, forincoming request:welcomeSocket =

ServerSocket()

create socket,connect to hostid, port=xclientSocket =

Socket()

closeconnectionSocket

read reply fromclientSocket

closeclientSocket

Server (running on hostid) Client

send request usingclientSocketread request from

connectionSocket

write reply toconnectionSocket

TCP connection setup

Client/Server Socket Interaction: TCPClient/Server Socket Interaction: TCP

Page 149: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-155155April 19, 2023

import java.io.*; import java.net.*; class TCPClient {

public static void main(String argv[ ]) throws Exception { String sentence; String modifiedSentence;

BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in));

Socket clientSocket = new Socket("hostname", 6789);

import java.io.*; import java.net.*; class TCPClient {

public static void main(String argv[ ]) throws Exception { String sentence; String modifiedSentence;

BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in));

Socket clientSocket = new Socket("hostname", 6789);

Createsinput stream

Creates client socket,

TCP connection to server

Example: TCPClient.javaExample: TCPClient.java

server name

server port no.

importStatements

make Java classes available

networking class

class: is a collection of data and methods that operate on that data

Page 150: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-156156April 19, 2023

DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());

BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));

sentence = inFromUser.readLine();

outToServer.writeBytes(sentence + '\n');

modifiedSentence = inFromServer.readLine();

System.out.println("FROM SERVER: " + modifiedSentence);

clientSocket.close(); } }

DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());

BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));

sentence = inFromUser.readLine();

outToServer.writeBytes(sentence + '\n');

modifiedSentence = inFromServer.readLine();

System.out.println("FROM SERVER: " + modifiedSentence);

clientSocket.close(); } }

Createsinput stream

attached to socket

Sends line

to serverReads line

from server

Example: TCPClient.java (cont.)Example: TCPClient.java (cont.)Creates

output streamattached to socket

Page 151: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-165165April 19, 2023

import java.io.*; import java.net.*;

class TCPServer {

public static void main(String argv[]) throws Exception { String clientSentence; String capitalizedSentence;

ServerSocket welcomeSocket = new ServerSocket(6789); while(true) { Socket connectionSocket = welcomeSocket.accept();

BufferedReader inFromClient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream()));

Createwelcoming socket

at port 6789

Wait, on welcomingsocket for contact

by client

Create inputstream, attached

to socket

Example: TCPServer.javaExample: TCPServer.java

Page 152: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-166166April 19, 2023

DataOutputStream outToClient = new DataOutputStream(connectionSocket.getOutputStream());

clientSentence = inFromClient.readLine();

capitalizedSentence = clientSentence.toUpperCase() + '\n';

outToClient.writeBytes(capitalizedSentence); } } }

Read in linefrom socket

Create outputstream,

attached to socket

Write out lineto socket

End of while loop,loop back and wait foranother client connection

Example: TCPServer.java (cont.)Example: TCPServer.java (cont.)

Page 153: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-173173April 19, 2023

closeclientSocket

Server (running on hostid)

read reply fromclientSocket

create socket,clientSocket = DatagramSocket()

Client

Create, address (hostid, port=x,send datagram request using clientSocket

create socket,port=x, forincoming request:serverSocket = DatagramSocket()

read request fromserverSocket

write reply toserverSocketspecifying clienthost address,port number

Client/Server Socket Interaction: UDPClient/Server Socket Interaction: UDP

Page 154: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-174174April 19, 2023

Example: Java Client (UDPExample: Java Client (UDP))

Output: sends packet (TCP sent

“byte stream”)

Input: receives packet (TCP received “byte stream”)

ProcessProcess

ClientSocketClientSocketre

cievepack

etse

ndpack

et

inFr

om

Use

r

InputStream

UDPdatagram

packet

UDPdatagrampacket

UDP socket

To transport layer

Fromtransport layer

Page 155: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-175175April 19, 2023

import java.io.*; import java.net.*; class UDPClient { public static void main(String args[]) throws Exception { BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in)); DatagramSocket clientSocket = new DatagramSocket(); InetAddress IPAddress = InetAddress.getByName("hostname"); byte[ ] sendData = new byte[1024]; byte[ ] receiveData = new byte[1024]; String sentence = inFromUser.readLine();

sendData = sentence.getBytes();

Createinput stream

Create client socket

Translate hostname to IP

address using DNS

Example: UDPClient.javaExample: UDPClient.java

Page 156: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-176176April 19, 2023

DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, 9876); clientSocket.send(sendPacket); DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); clientSocket.receive(receivePacket); String modifiedSentence = new String(receivePacket.getData()); System.out.println("FROM SERVER:" + modifiedSentence); clientSocket.close(); }

}

Create datagram with data-to-send,

length, IP addr, port

Send datagramto server

Read datagramfrom server

Example: Example: UDPClient.java (cont.)Example: Example: UDPClient.java (cont.)

Page 157: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-185185April 19, 2023

import java.io.*; import java.net.*; class UDPServer { public static void main(String args[ ]) throws Exception { DatagramSocket serverSocket = new DatagramSocket(9876); byte[ ] receiveData = new byte[1024]; byte[ ] sendData = new byte[1024]; while(true) { DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);

serverSocket.receive(receivePacket);

Createdatagram socket

at port 9876

Create space forreceived datagram

Receivedatagra

m

Example: UDPServer.javaExample: UDPServer.java

Page 158: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-186186April 19, 2023

String sentence = new String(receivePacket.getData()); InetAddress IPAddress = receivePacket.getAddress(); int port = receivePacket.getPort(); String capitalizedSentence = sentence.toUpperCase();

sendData = capitalizedSentence.getBytes(); DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, port); serverSocket.send(sendPacket); } }

}

Get IP addrport #, of

sender

Write out datagramto socket

End of while loop,loop back and wait foranother datagram

Create datagramto send to client

Example: Example: UDPServer.java (cont.)Example: Example: UDPServer.java (cont.)

Page 159: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-187187April 19, 2023

handles one HTTP request

accepts the request parses header obtains requested file

from server’s file system

creates HTTP response message: header lines + file

sends response to client

after creating server, you can request file using a browser (eg IE explorer)

see the following slides for details.

Building a Simple Web ServerBuilding a Simple Web Server

Page 160: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-188188April 19, 2023

Example: WebServer.javaExample: WebServer.java

import java.io.*;

import java.net.*;

import java.util.*;

class WebServer {

public static void main(String argv[ ]) throws Exception

{

String requestMessageLine;

String fileName;

ServerSocket listenSocket = new ServerSocket(6789);

Socket connectionSocket = listenSocket.accept();

BufferedReader inFromClient = new BufferedReader(

new InputStreamReader(connectionSocket.getInputStream()));

DataOutputStream outToClient =

new DataOutputStream(connectionSocket.getOutputStream());

import java.io.*;

import java.net.*;

import java.util.*;

class WebServer {

public static void main(String argv[ ]) throws Exception

{

String requestMessageLine;

String fileName;

ServerSocket listenSocket = new ServerSocket(6789);

Socket connectionSocket = listenSocket.accept();

BufferedReader inFromClient = new BufferedReader(

new InputStreamReader(connectionSocket.getInputStream()));

DataOutputStream outToClient =

new DataOutputStream(connectionSocket.getOutputStream());

contain the first line in the HTTP request messagecontain the file name of the requested file

contain the first line in the HTTP request messagecontain the file name of the requested file

When a request for a connection arrives, the accept( ) method of listenSocket creates a new object, connectionSocket, of type Socket.

When a request for a connection arrives, the accept( ) method of listenSocket creates a new object, connectionSocket, of type Socket.

two s

tream

s are

cr

eate

dtw

o s

tream

s are

cr

eate

d

Page 161: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-189189April 19, 2023

Example: WebServer.java (cont.)Example: WebServer.java (cont.)

requestMessageLine = inFromClient.readLine();

StringTokenizer tokenizedLine =

new StringTokenizer(requestMessageLine);

If(tokenizedLine.nextToken().equals("GET")) {

fileName = tokenizedLine.nextToken();

if (fileName.startsWith("/") == true )

fileName = fileName.substring(1);

File file = new File(fileName);

int numOfBytes = (int) file.length();

FileInputStream inFile =

new FileInputStream (fileName);

byte[ ] fileInBytes = new byte[ ];

inFile.read(fileInBytes);

requestMessageLine = inFromClient.readLine();

StringTokenizer tokenizedLine =

new StringTokenizer(requestMessageLine);

If(tokenizedLine.nextToken().equals("GET")) {

fileName = tokenizedLine.nextToken();

if (fileName.startsWith("/") == true )

fileName = fileName.substring(1);

File file = new File(fileName);

int numOfBytes = (int) file.length();

FileInputStream inFile =

new FileInputStream (fileName);

byte[ ] fileInBytes = new byte[ ];

inFile.read(fileInBytes);

reads the first line of the HTTP request message.reads the first line of the HTTP request message.

tokenizedLine holds the request line with each of the "words" GET, file_name, and HTTP/1.1 placed in a separate placeholder called a token.

tokenizedLine holds the request line with each of the "words" GET, file_name, and HTTP/1.1 placed in a separate placeholder called a token.

removes the backslash that may precede the filename.

removes the backslash that may precede the filename.

These commands determine the size of the file and construct an array of bytes of that size. The name of the array is fileInBytes.

These commands determine the size of the file and construct an array of bytes of that size. The name of the array is fileInBytes.

reads from the stream inFile to the byte array fileInBytes

reads from the stream inFile to the byte array fileInBytes

Page 162: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-190190April 19, 2023

Example: WebServer.java (cont.)Example: WebServer.java (cont.)

outToClient.writeBytes(

"HTTP/1.0 200 Document Follows\r\n");

if (fileName.endsWith(".jpg"))

outToClient.writeBytes("Content-Type:image/jpeg\r\n");

if (fileName.endsWith(".gif"))

outToClient.writeBytes("Content-Type:image/gif\r\n");

outToClient.writeBytes("Content-Length: " +numOfBytes + "\r\n");

outToClient.writeBytes("\r\n");

outToClient.write(fileInBytes, 0, numOfBytes);

connectionSocket.close();

}

else System.out.println("Bad Request Message");

} }

outToClient.writeBytes(

"HTTP/1.0 200 Document Follows\r\n");

if (fileName.endsWith(".jpg"))

outToClient.writeBytes("Content-Type:image/jpeg\r\n");

if (fileName.endsWith(".gif"))

outToClient.writeBytes("Content-Type:image/gif\r\n");

outToClient.writeBytes("Content-Length: " +numOfBytes + "\r\n");

outToClient.writeBytes("\r\n");

outToClient.write(fileInBytes, 0, numOfBytes);

connectionSocket.close();

}

else System.out.println("Bad Request Message");

} }

sends the mandatory status line: HTTP/1.1 200 Document Follows, followed by a carriage return and a line feed.

sends the mandatory status line: HTTP/1.1 200 Document Follows, followed by a carriage return and a line feed.

◊ to transfer a GIF image, server prepares the header line Content-Type: image/gif. ◊ to transfer a JPEG image, server prepares the header line Content-Type: image/jpeg.

◊ to transfer a GIF image, server prepares the header line Content-Type: image/gif. ◊ to transfer a JPEG image, server prepares the header line Content-Type: image/jpeg.sends a

content-length

header line and a

mandatory blank line

sends a content-

length header line

and a mandatory blank line

sends the requested file, fileInBytes, to the TCP send buffer

sends the requested file, fileInBytes, to the TCP send buffer

closing the socket connectionSocketclosing the socket connectionSocket

Page 163: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-204204April 19, 2023

C-language tutorial (audio/slides): “Unix Network Programming” (J. Kurose),http://manic.cs.umass.edu/~amldemo/courseware/intro.

Java-tutorials: “All About Sockets” (Sun tutorial),

http://www.javaworld.com/javaworld/jw-12-1996/jw-12-sockets.html

“Socket Programming in Java: a tutorial,” http://www.javaworld.com/javaworld/jw-12-1996/jw-12-sockets.html

Socket Programming: ReferencesSocket Programming: References

Page 164: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-205205April 19, 2023

2.1 Principles of app layer protocols clients and servers app requirements

2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail

SMTP, POP3, IMAP 2.5 DNS

2.6 Socket programming with TCP

2.7 Socket programming with UDP

2.8 Building a Web server 2.9 Content

distribution (delivery) Network Web caching Content distribution

networks P2P file sharing

Chapter 2 OutlineChapter 2 Outline

Page 165: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-206206April 19, 2023

browsers

Web serverWeb server

networks

Content Content DistributionDistribution Network Network

Page 166: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-207207April 19, 2023

routers

The Problem: CongestionThe Problem: Congestion

browsersnetworks

serversservers

Page 167: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-208208April 19, 2023

browsers

server

replicatedcontent(mirror)

routercontent source

content sink(cache)

Content Delivery Network: IdeaContent Delivery Network: Idea

Page 168: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-209209April 19, 2023

Content Distribution MetricContent Distribution Metric

Cost × Performance analysis is the key metric to the effectiveness of an information (content) distributed system.

Page 169: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-210210April 19, 2023

The conventional Technologies are: Proxy cache server, and Mirror server

They are cost effective technologies which enhance the performance, namely: Reducing the latency of access. Reducing the network bandwidth required for

document transfers. Reducing the demand on servers with very popular

documents. Improving the security of electronic file transfer.

Servers: Caching, and MirrorServers: Caching, and Mirror(content distribution strategies)(content distribution strategies)

Page 170: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-211211April 19, 2023

Caching: ideaCaching: idea(information distribution strategies)(information distribution strategies)

Basic idea in caching: Store the frequently retrieved documents into

local files or proxies for future use. It improves:

access speed and cuts down on network traffic.

It also reduces: the server load and increase availability in the web by replicating

documents among many servers (cache).

Page 171: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-212212April 19, 2023

Caching: client - networkCaching: client - network(information distribution strategies)(information distribution strategies)

Caching on client disk: Browsers maintain small caches of previously-

viewed pages on the user’s local disk. ( example: Documents and Settings\WELCOME\Local Settings\Temporary Internet Files )

Network caching: Caching system is located on machine in

the path from multiple clients to multiple servers.

Page 172: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-213213April 19, 2023

Caching: proxyCaching: proxy(information distribution strategies)(information distribution strategies)

Caching proxy servers can be located near a large community of users such as:

on a campus network, at an intranet server, or at an ISP server.

Caching proxy servers can be located near a large community of users such as:

on a campus network, at an intranet server, or at an ISP server.

HTML, FTP, Search, Database

origin servers

Proxy Architecture

originservers

institutionalnetwork

institutionalCache(Proxy

server)

Internet

LAN router Internetrouter

Page 173: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-214214April 19, 2023

user sets browser: Web accesses via cache (proxy)

browser sends all HTTP requests to cache (proxy)

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.

Goal: satisfy client request without involving origin server.

client

Proxyserver

client

HTTP request

HTTP request

HTTP response

HTTP response

HTTP request

HTTP response

origin server

origin server

Web Caches (Proxy web-Server)Web Caches (Proxy web-Server)

Page 174: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-215215April 19, 2023

Cache acts as both client and server

Cache can do up-to-date check using If-modified-since HTTP header

Issue: should cache take risk and deliver cached object without checking?

Heuristics are used. Typically cache is

installed by ISP (university, company, residential ISP)

Why Web caching? Reduce response time for

client request. Reduce traffic on an

institution’s access link. Internet dense with

caches enables “poor” content providers to effectively deliver content

Why Web caching? Reduce response time for

client request. Reduce traffic on an

institution’s access link. Internet dense with

caches enables “poor” content providers to effectively deliver content

More about Web CachingMore about Web Caching

Page 175: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-216216April 19, 2023

Service ProvidingEntity

λ :Arrival (request) Departure (response)

Content Distribution ModelContent Distribution Model

λ :Arrival (request) Departure (response)

Service ProvidingEntity

Service Providing Entity examples: Server LAN Access Link …

Service Providing Entity examples: Server LAN Access Link …

in servicewaiting

Page 176: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-217217April 19, 2023

Model ParametersModel Parameters

λ: Average Arrival rate [requests/sec]

S: Average Service time [sec/response];

Example1: Server λ: Average Arrival rate [file request/sec]

S: Average Service time [sec/file response];

Example2: Link, LAN λ: Average Arrival rate [bit/sec]

S: Average Service time [sec/file] = L/R; L: file length, R: Link

Bandwidth

λ :Arrival (request) Departure (response)

Service ProvidingEntity

in servicewaiting

S

Page 177: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-218218April 19, 2023

Model Equations (M/M/1)Model Equations (M/M/1)

Utilization of Service Providing Entity = U = λxS;

(λ≤1/S)

delay (Response Time)=Service Time + Waiting

Time;

delay = S/(1-U);

Waiting Time (Queuing Delay) = delay – S

Page 178: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-219219April 19, 2023

Equations for Link, LANEquations for Link, LAN

λ = a [files/sec]; rate of files entering into the

link, LAN

S = L/R [sec/file]; the time needed to pass a

file through the Link, LAN

U = λxS = La/R [ ]; Link, LAN Utilization

I = U [ ]; Link, LAN Traffic Intensity

delay = S/(1-U) = L/[R(1-U)] [secs/file]

Page 179: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-220220April 19, 2023

Link Response TimeLink Response Time

Uuplink = Lreq λ /Rlink = Iup

link

delayup = Sup/(1-Uuplink) [sec/req]

Udownlink = Lres λ’ /Rlink = Idown

link

delaydown = Sdown/(1-Udownlink) [sec/res]

delay = delayup + delaydown ≈ delaydown

It is because: Lres >> Lreq

Ruplink

LAN router

Internet router

Files from origin servers

Rdownlink

Request from clientsλ

λ’

Page 180: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-221221April 19, 2023

Caching Example1 (1)Caching Example1 (1)

Assumptions

Average request rate from institution’s browser to origin

serves: λ = 15reqs/sec

Average request massage size ≈ 0 bit

Average object size = L= 100,000 bits

Internet delay ≈ 2 sec (average)

Time spent in the Internet

originservers

public Internet

LAN

Rlink =1.6 Mbps (up and down)

Rlan =10 Mbps

Page 181: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-222222April 19, 2023

Caching Example1 (2)Caching Example1 (2)delay is calculated for down stream

only:

LAN Service time= Slan = L/Rlan = 10

msec

LAN Utilization = La/Rlan = 0.15 =

15% LAN delay =S/(1-U) = 10/0.85 =11.8

msec

Link Service time Slink = L/Rlink = 62.5

msec Link Utilization (Traffic Intensity) =

La/Rlink = 93.75%

Link delay = 62.5/0.0625 = 1000 msec

delay = Internet delay + access-link delay + LAN delay =

2000 + 1000 + 11.8 =3011.8 msecs

qrouter = 1000 – 62.5 = 937.5 msec

originservers

public Internet

LAN

Rlink =1.6 Mbps access-link

Rlan =10 Mbps

937.5 msecs

62.5 msecs

11.8 msecs

Page 182: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-223223April 19, 2023

Caching Example2Caching Example2Upgrade the link:

LAN Service time= Slan = L/Rlan = 10

msec

LAN Utilization = La/Rlan = 0.15 = 15%

LAN delay = S/(1-U) = 10/0.85 = 11.8 msec

Link Service time Slink = L/Rlink = 10

msec Link Utilization (Traffic Intensity) =

La/Rlink = 15%

Link delay = 11.8 msec

delay = Internet delay + access-link delay + LAN delay =

2000 + 11.8 + 11.8 =2023.6 msecs

qrouter = 11.8 – 10 = 1.8 msec

originservers

public Internet

LAN

Rlink =10 Mbps access-link

Rlan =10 Mbps

1.8 msecs

10 msecs

11.8 msecs

Often a costly upgrade

Page 183: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-224224April 19, 2023

Install cache suppose hit rate is 0.4

Consequence 40% requests will be satisfied

almost immediately 60% requests satisfied by origin

server utilization of access link (reduced

to 60%) = 0.6 *93.75= 56.25% Link delay = 62.5/0.4375 = 143

msec delay = 0.4* 11.8 + 0.6 x (2000

+ 143 + 11.8+11.8) = 1304.68msec

Caching Example3Caching Example3

originservers

public Internet

LAN

Rlink =1.6 Mbps access-link

Rlan =10 Mbps

80.5 msecs

62.5 msecs

11.8 msecs

Network cache

Page 184: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-225225April 19, 2023

The content (information) providers are the CDN customers.

Content replication (mirror) CDN company installs

hundreds of CDN servers throughout Internet. in lower-tier ISPs, close

to users. CDN replicates its

customers’ content in CDN servers. When provider updates content, CDN updates servers.

Content Distribution Network: ideaContent Distribution Network: idea

origin server in North America

CDN distribution node

CDN serverin S. America CDN server

in Europe

CDN serverin Asia

Page 185: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-226226April 19, 2023

1. Origin server informs RR of Content Availability.

2. Content Pushed to Distribution System.

3. Client Requests Content, Origin server redirects client to RR.

4. Client sends query to RR.

5. RR finds the most suitable Mirror Server.

6. Mirror server receives client request and provides services.

1. Origin server informs RR of Content Availability.

2. Content Pushed to Distribution System.

3. Client Requests Content, Origin server redirects client to RR.

4. Client sends query to RR.

5. RR finds the most suitable Mirror Server.

6. Mirror server receives client request and provides services.

CDN: Architectural LayoutCDN: Architectural LayoutRequestRequest

Routing(RR)Routing(RR)RequestRequest

Routing(RR)Routing(RR)

Distribution Distribution NodeNode

Distribution Distribution NodeNode

OriginOriginServerServerOriginOriginServerServer

1

2a

ClientClientClientClient

MirrorMirrorServerServerMirrorMirrorServerServer

2b 3

5

6

4

Page 186: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-227227April 19, 2023

routing requests CDN creates a

“map”, indicating distances from leaf ISPs and CDN nodes

when query arrives at authoritative DNS server: server determines

ISP from which query originates

uses “map” to determine best CDN server

routing requests CDN creates a

“map”, indicating distances from leaf ISPs and CDN nodes

when query arrives at authoritative DNS server: server determines

ISP from which query originates

uses “map” to determine best CDN server

not just Web pages streaming stored

audio/video streaming real-time

audio/video CDN nodes create

application-layer overlay network

not just Web pages streaming stored

audio/video streaming real-time

audio/video CDN nodes create

application-layer overlay network

بر روی شبكه ياليه ي كاربرد

More about CDNsMore about CDNs

Page 187: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-228228April 19, 2023

Overlay networksOverlay networks

IP

Overlay

X

Y

Edge between peer X and Y if there is a TCP connection. All active peers and edges is overlay network. Edge is not a physical link. Given peer will typically be connected with <10 overlay neighbors

Edge between peer X and Y if there is a TCP connection. All active peers and edges is overlay network. Edge is not a physical link. Given peer will typically be connected with <10 overlay neighbors

Page 188: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-229229April 19, 2023

Overlay NetworksOverlay Networks

IP

Overlay

Page 189: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-230230April 19, 2023

Example User1 runs P2P client runs P2P client

application on his application on his notebook computer.notebook computer.

Intermittently connects to Internet; gets new IP address for each connection.

Asks for “network e-book” Application displays other

peers that have copy of network e-book.

Example User1 runs P2P client runs P2P client

application on his application on his notebook computer.notebook computer.

Intermittently connects to Internet; gets new IP address for each connection.

Asks for “network e-book” Application displays other

peers that have copy of network e-book.

User1 chooses one of the peers, User2.

File is copied from User2’s PC to User1’s notebook: HTTP

While User1 downloads, other users uploading from User1.

User1’s peer is both a Web client and a transient Web server.

User1 chooses one of the peers, User2.

File is copied from User2’s PC to User1’s notebook: HTTP

While User1 downloads, other users uploading from User1.

User1’s peer is both a Web client and a transient Web server.

All peers are servers = highly scalable!All peers are servers = highly scalable!All peers are servers = highly scalable!All peers are servers = highly scalable!

P2P File SharingP2P File Sharing

Page 190: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-233233April 19, 2023

Example: University of Washington (2002)Example: University of Washington (2002)

UW is an HTTP content provider Exported 16.65 TB - Imported 3.44 TB

Bandwidth consumption (in + out) 0.2% Akamai (overnet. eDonkey) [content delivery

networks] 6.04% Gnutella (p2p system) 14.3% WWW 36.9% Kazaa (p2p system) 43% other TCP protocols, e.g. mail, streaming video

Page 191: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-234234April 19, 2023

PropertiesProperties

No central control, no central database No hierarchy

Every node is both a client and a server The communication between peers is symmetric

No global view of the system Scalability

Availability for any peer Peers are autonomous System globally unreliable

Robustness and security issues

Page 192: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-235235April 19, 2023

Examples of p2p ApplicationsExamples of p2p Applications

File-sharing applications Napster, KazaA, Gnutella,

Freenet, … E-Commerce Systems

eBay, … Parallel Processing

Distributed computing (grid?), SETI (Internet-connected computers used for Search for Extraterrestrial Intelligence), …

Collaboration Distributed (Internet)

games, Instant messaging, Shared Application, …

Distributed databases Mariposa, Litwin, Yokota,

Plaxton, … Mobile Ad hoc networks

(Unstructured networks) Application-level multicast …

Page 193: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-236236April 19, 2023

How Much P2P is Involved?How Much P2P is Involved?

P2P User Interaction

P2P Application

P2P Information Management

eBay yes no no

Napster yes yes no

Gnutella, Freenet

yes yes yes

Page 194: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-237237April 19, 2023

Types of P2P SystemsTypes of P2P Systems

Hybrid or Centralized (Napster) Pure or Decentralized (Gnutella, Freenet) Super Peers or Hierarchical (KaZaA, DNS) Redundant Super Peers (DNS)

Page 195: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-238238April 19, 2023

Hybrid or Centralized P2PHybrid or Centralized P2P

In a hybrid P2P system, some operations are performed at a central server.

For other operations, the peers have equal status.

Example: Napster file download Central server contains an index of the files located at

all the peers currently available. Peer 1 asks server where a file is located. Server returns address of Peer 2 who has the file. Peer 1 asks Peer 2 (directly) for the file. Next 2 slides

Page 196: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-239239April 19, 2023

Hybrid SystemHybrid System

2

3

4

5

1

1 5

2 5

3 4

4

5

Who has 1 5

Give me

Page 197: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-240240April 19, 2023

Original “Napster” design1) Peers to notify server when

they join and leave:(IP Add, Port Num)

Peers to notify server if their available files change:

ContentsPeers to run a “server” program that listens on a port for download requests.

2) User1 queries for “network e-book”,

3) User1 requests file from User2.

peers

User1

User2

1

1

1

12

3

Napster as a Centralized SystemNapster as a Centralized System

1

2

3

°

°

°

locationserver

Page 198: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-241241April 19, 2023

Centralized model (Napster)Centralized model (Napster)

INTERNET

locationserver

register

Document x?OK: Peer ZIP = a.b.c.d

Document x!

x

Peer ZIP: a.b.c.d

Page 199: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-242242April 19, 2023

Hybrid: Ads and DisAdsHybrid: Ads and DisAds

Advantages: Search is generally efficient

Disadvantages High cost on centralized index Performance & scalability bottleneck Vulnerable! Highly visible target

Page 200: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-243243April 19, 2023

Pure P2P-1Pure P2P-1

All peers have equal roles in all responsibilities Example: Gnutella

In order to find an item, Peer 1 asks his neighbors if they have it.

They ask their neighbors, and so on

A message has a “time to live” which determines how long it will be sent along. Why is this needed?

Different search strategies will be discussed later

Page 201: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-244244April 19, 2023

Pure P2P-2Pure P2P-2

What happens when a peer (say, Peer 34) is identified, who has the file that Peer 1 wants?

2 Different options are in use in different systems Peer 34 directly sends file to Peer 1 Peer 34 sends the file back in the same route that it

was requested Advantages/disadvantages of each option?

Page 202: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-245245April 19, 2023

Pure P2PPure P2P

??

??

??

?

?

?

Page 203: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-246246April 19, 2023

Pure P2P: Option 1Pure P2P: Option 1

Page 204: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-247247April 19, 2023

Pure P2P: Option 2Pure P2P: Option 2

Page 205: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-248248April 19, 2023

Gnutella: protocolGnutella: protocol

Query message HTTP sent over existing TCP connections

Gnutella on ports 6346 and 6347

peers forward Query message

QueryHit sent over reverse path

Scalability: limited scopeflooding

Query QueryHit

Query

QueryHit

QueryHit Query

Query

Query

File

Tran

sfer:

http

Page 206: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-249249April 19, 2023

Gnutella Protocol MessagesGnutella Protocol Messages

Broadcast Messages Ping: initiating message (“I’m here”) Query: search pattern and TTL (time-to-live)

Back-Propagated Messages Pong: reply to a ping, contains information about the

peer Query response: contains information about the

computer that has the needed file Node-to-Node Messages

GET: return the requested file PUSH: push the file to me

Page 207: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-250250April 19, 2023

Peer Joining in GnutellaPeer Joining in Gnutella

Joining peer X must find some other peer in Gnutella network; use list of candidate peers.

X sequentially attempts to make TCP connection with peers on list until connection setup with Y.

X sends Ping message to Y; Y forwarded Ping message. All peers receiving Ping message respond with Pong

message. X receives many Pong messages. It can then setup

additional TCP connections.

Peer living!

Page 208: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-251251April 19, 2023

Topology of GnutellaTopology of Gnutella

Backbone Backbone + Outskirts

Page 209: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-252252April 19, 2023

Pure: Ads and DisAdsPure: Ads and DisAds

Advantages: Easy to start No maintenance needed Hard to shut down privacy

Disadvantages: Inefficient search Lot of network traffic Bottlenecks (limited peers)

Page 210: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-253253April 19, 2023

Super PeersSuper Peers

Make use of heterogeneity Powerful peers serve as super peers Weaker peers act as clients Example: KaZaA

Super-peers index clients’ files Requires updates on join/leave/update

Queries handled at super-peer level. Query evaluation between super-peers similar to

query evaluation between peers in a pure system.

Page 211: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-254254April 19, 2023

Super PeersSuper Peers

Page 212: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-255255April 19, 2023

Each peer is either a group leader or assigned to a group

leader. Group leader tracks

the content in all its children.

Each peer queries its group leader.

Group leader may query other group leaders.

KazaA on port 1214

ordinary peer (ordinary node)

group-leader peer (super node)

neighboring relationshipsin overlay network

Decentralized Directory (KaZaA)Decentralized Directory (KaZaA)

Page 213: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-256256April 19, 2023

KazaA QueryKazaA Query

Each file has a hash and a descriptor. Client sends keyword query to its group

leader. Group leader responds with matches;

For each match: metadata, hash, IP address

If group leader forwards query to other group leaders, they respond with matches.

Client then selects files for downloading; HTTP requests using hash as identifier sent to peers

holding desired file.

Page 214: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-257257April 19, 2023

Super Peers: Ads and DisAdsSuper Peers: Ads and DisAds

Advantages: All the advantages of pure Takes advantage of different peer capabilities

Disadvantages: Super nodes might become bottlenecks for clients Clients are disconnected when super peer leaves Inefficient search (but better than Pure P2P) Maintenance costs for super peers

Page 215: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-258258April 19, 2023

Redundant Super Peers Redundant Super Peers

Like super peers, but each super-peer is k-redundant, i.e., there are k nodes sharing the super peer load all k nodes have the same indexes of all the clients clients ask super-peer queries in a round robin fashion

Page 216: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-259259April 19, 2023

Super PeersSuper Peers

Page 217: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-260260April 19, 2023

Redundant Super PeersRedundant Super Peers

Page 218: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-261261April 19, 2023

Redundant Super Peers: Ads and DisAdsRedundant Super Peers: Ads and DisAds

Advantages All advantages of super-peers load of queries is shared among peers less points of fail

Disadvantages additional maintenance: nodes must notify all

redundant super-peers upon joining, leaving, updating files

Additional connections between super-peers required

Page 219: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-262262April 19, 2023

Non-structured system (Gnutella-like)Non-structured system (Gnutella-like)

Two phases (like Napster) Localization + exchange

No server Open source

gnutella.wego.com Distributed search

The query is flooded Loop avoidance Limited TTL (not all nodes are visited)

Page 220: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-263263April 19, 2023

Structured systems (DHTs)Structured systems (DHTs)

Based on Distributed Hash Tables (DHTs) No flooding

Exact matches Overhead

Gnutella-like O(n) DHT O(log n)

Examples CAN, Pastry, Chord, Kademlia, Tapestry, P-Grid, ...

Page 221: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-275275April 19, 2023

Application-layer multicastApplication-layer multicast

Native multicast not yet completely deployed

ALM easier/faster to implement Scalability states at end-systems High-level support

Page 222: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-276276April 19, 2023

Application-layer multicastApplication-layer multicast

source

Page 223: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-277277April 19, 2023

Many works and projectsMany works and projects

Gnutella and Napster @sourceforge.net

Page 224: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-278278April 19, 2023

JXTA (Sun)JXTA (Sun)

Open platform for p2p cooperation

Interoperability Any system/peer/application

Platform independency Languages (C, Java, etc) Systems platforms (Unix, Windows, etc) Networking platforms (802.11, Bluetooth, TCP/IP, etc)

Ubiquity Sensors, PDAs, routers, desktops, laptops, storage

systems

Page 225: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-279279April 19, 2023

JXTA (Sun)JXTA (Sun)

Objectives Find peers and resources Share files with anyone across the network Create a particular group of peers across different

networks Communicate securely with peers across public networks

Projects Applications (24 projects) Core (13 projects) Demos (3 projects) Forge (15 projects) Other (12 projects) Services (24 projects)

Page 226: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-280280April 19, 2023

JXTA (Sun) JXTA (Sun) Protocols Protocols

Peer discovery protocol Peer resolver protocol Peer information protocol Rendezvous protocol Pipe binding protocol Endpoint routing protocol

Page 227: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-281281April 19, 2023

JXTA (Sun)JXTA (Sun)

Peer (Desktop, cell phone, PDA, etc.)

Security

Peer Groups Peer Pipes Peer Monitoring

JXTA Community ServicesSun JXTAServices

JXTAShell

PeerCommands

JXTA Community Applications

CORE

JXTA

Page 228: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-282282April 19, 2023

JXTA applicationsJXTA applications

Page 229: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-283283April 19, 2023

Final remarksFinal remarks

P2P implies a very large spectrum of areas High interest in both academicals/industrials Much has already been done, but no

conclusions are definitive IPv6 and P2P

NAT, firewalls, IPv6 as an overlay Many open issues

Trust, security, scalability, QoS, etc.

Page 230: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-284284April 19, 2023

application service requirements:

reliability, bandwidth, delay.

client-server paradigm.

Internet transport service model.

connection-oriented, reliable: TCP

unreliable, datagrams: UDP

application service requirements:

reliability, bandwidth, delay.

client-server paradigm.

Internet transport service model.

connection-oriented, reliable: TCP

unreliable, datagrams: UDP

Our study of network apps now complete!Our study of network apps now complete!

specific protocols: HTTP FTP SMTP, POP, IMAP DNS

socket programming

content distribution caches, CDNs P2P

specific protocols: HTTP FTP SMTP, POP, IMAP DNS

socket programming

content distribution caches, CDNs P2P

Chapter 2: Summary1Chapter 2: Summary1

Page 231: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-285285April 19, 2023

typical request/reply message exchange: client requests info or

service server responds with

data, status code message formats:

headers: fields giving information about data

data: information being communicated

typical request/reply message exchange: client requests info or

service server responds with

data, status code message formats:

headers: fields giving information about data

data: information being communicated

Most importantly: learned about protocolsMost importantly: learned about protocols

control vs data messages in-band, out-of-band

centralized vs. decentralized

stateless vs. stateful reliable vs. unreliable msg

transfer “complexity at network edge” security: authentication

control vs data messages in-band, out-of-band

centralized vs. decentralized

stateless vs. stateful reliable vs. unreliable msg

transfer “complexity at network edge” security: authentication

Chapter 2: Summary2Chapter 2: Summary2

Page 232: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-286286April 19, 2023

Complimentary Hyperlinks This part provides hyperlinks to interesting

(and hopefully useful) computer-networking resources.

Most of these resources provide complimentary information to the material in chapter 2.

If you're asked to write a paper pertaining to a specialized topic in computer networking, these resources should serve as a good starting point for your research.

Complimentary Hyperlinks This part provides hyperlinks to interesting

(and hopefully useful) computer-networking resources.

Most of these resources provide complimentary information to the material in chapter 2.

If you're asked to write a paper pertaining to a specialized topic in computer networking, these resources should serve as a good starting point for your research.

References & LinksReferences & Links

References and Hyperlinks

Page 233: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-287287April 19, 2023

Unix Network Programming http://www-aml.cs.umass.edu/~jsmanic/unetpgm

Online tutorial on Unix socket programming, using slides and audio, from author James Kurose.

Tutorial on Java sockets http://www.javaworld.com/javaworld/jw-12-1996/jw-12-sockets.html

This tutorial presents an introduction to sockets programming and shows how to write client/server applications in Java.

Complimentary Hyperlinks1Complimentary Hyperlinks1

Page 234: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-288288April 19, 2023

The World Wide Web Consortium (W3C) http://www.w3.org/ The W3C was founded in 1994 to develop common protocols for the

evolution of the World Wide Web. This is an outstanding site with fascinating information on emerging Web technologies, protocols, and standards.

Web Protocols and Practice http://www.aw.com/catalog/academic/product/1,4096,0201710889,00.html

Web Protocols and Practice: HTTP/1.1, Networking Protocols, Caching, and Traffic Measurement, a comprehensive and readable book by Balachander Krishnamurthy and Jennifer Rexford on Web protocols and related topics.

Cookie Central http://www.cookiecentral.com/ Everything you ever wanted to know about cookies, including how they

infringe on users' privacy.

The IMAP Connection http://www.imap.org/ Everything you always wanted to know about IMAP, including history, direct

access to relevant RFCs, and product information.

Complimentary Hyperlinks2Complimentary Hyperlinks2

Page 235: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-289289April 19, 2023

ISC BIND http://www.isc.org/products/BIND DNS name servers use the Berkeley Internet Name Domain

(BIND) software. You can learn about it (and download it) here.

Exploring Name Servers http://www.unhooked.net/cgi-bin/host

nslookup, host, and dig are client programs available for exploring the contents of name servers in the Internet. Several sites, including the one listed above, allow you to access these programs through a Web browser. All of these programs mimic DNS clients. They send a DNS query message to a name server (which can often be supplied by the user), and they receive a corresponding DNS response. They then extract information (e.g., IP addresses, whether the response is authoritative, etc.) and present the information to the user.

Complimentary Hyperlinks3Complimentary Hyperlinks3

Page 236: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-290290April 19, 2023

Online Java Tutorial http://java.sun.com/docs/books/tutorial Do you what to learn Java before doing the programming

exercises? This is an excellent place to start.

Akamai Homepage http://www.akamai.com/ Homepage for leading Content Distribution Network (CDN)

company.

Developers Site for Gnutella http://www.gnutelladev.com/ Includes links to source code as well as links to documentation of

the protocol.

Complimentary Hyperlinks 4Complimentary Hyperlinks 4

Page 237: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-291291April 19, 2023

A note on Internet Request for Comments (RFCs): Copies of Internet RFCs are maintained at multiple sites. The RFC URLs below all point into the RFC archive at the Information Sciences Institute (ISI), maintained the the RFC Editor of the Internet Society (the body that oversees the RFCs). Other RFC sites include http://www.faqs.org/rfc, http://www.pasteur.fr/other/computer/RFC (located in France), and http://www.csl.sony.co.jp/rfc/ (located in Japan). 

Internet RFCs can be updated or obsoleted by later RFCs. We encourage you to check the sites listed above for the most up-to-date information. The RFC search facility at ISI, http://www.rfc-editor.org/rfcsearch.html, will allow you to search for an RFC and show updates to that RFC. 

[Abitz 1993] P. Albitz and C. Liu, DNS and BIND, O'Reilly & Associates, Petaluma, CA, 1993. 

[Akamai 2000] Akamai homepage, http://www.akamai.com

References and Hyperlinks1References and Hyperlinks1

Page 238: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-292292April 19, 2023

[Berners-Lee 1994] T. Berners-Lee, R. Cailliau, A. Luotonen, H. Frystyk Nielsen, and A. Secret, "The World-Wide Web," Commun. ACM 37, 8 (Aug. 1994), Pages 76-82 

[BIND 2000] Internet Software Consortium page on BIND, http://www.isc.org/bind.html

[Claffy 1998] K. Claffy, G. Miller, and K. Thompson, "The Nature of the Beast: Recent Traffic Measurements from an Internet Backbone," Proceedings of Inet '98 , (Geneva, Switzerland, July 1998), http://www.caida.org/outreach/resources/papers/Inet98/

[Cookie Central 2000] Cookie Central homepage, http://www.cookiecentral.com

[Cusumano 1998] M.A. Cusumano and D.B. Toffle, Competing on Internet Time: Lessons from Netscape and its Battle with Microsoft, Free Press, 1998 

[DNSNet] DNSNet page on DNS resources, http://www.dns.net/dnsrd/docs/

References and Hyperlinks2References and Hyperlinks2

Page 239: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-293293April 19, 2023

[Frost 1994] J. Frost, "BSD Sockets: A Quick and Dirty Primer," http://world.std.com/~jimf/papers/sockets/sockets.html

[Gauthier 1999] L. Gauthier, C. Diot, and J. Kurose, "End-to-end Transmission Control Mechanisms for Multiparty Interactive Applications on the Internet," Proceedings of IEEE Infocom '99, (New York, NY, Apr. 1999). ftp://ftp.sprintlabs.com/diot/infocom99-mimiaze.zip

[Gay 1997] V. Gay and B. Dervella, "MHEGAM--A Multimedia Messaging System," IEEE Multimedia Magazine, Oct.-Dec. 1997, pp. 22-29. 

References and Hyperlinks3References and Hyperlinks3

Page 240: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-294294April 19, 2023

[Heidemann 1997] J. Heidemann, K. Obraczka, and J. Touch, "Modeling the Performance of HTTP over Several Transport Protocols," IEEE/ACM Transactions on Networking, Vol. 5, No. 5 (Oct. 1997), pp. 616-630. 

[Hess 1998] C. Hess, D. Lin and K. Nahrstedt, "VistaMail: An Integrated Multimedia Mailing System," IEEE Multimedia Magazine, Oct.-Dec. 1998, pp. 13-23. 

[Huffaker 1998] B. Huffaker, J. Jung, D. Wessels, and K. Claffy, "Visualization of the Growth and Topology of the NLANR Caching Hierarchy," The 3rd Web Caching Workshop, June 1998, England. http://www.caida.org/tools/visualization/plankton/Paper/plankton.xml

References and Hyperlinks4References and Hyperlinks4

Page 241: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-295295April 19, 2023

[IMAP 1999] The IMAP Connection, http://www.imap.org/ [ITU 1997] International Telecommunications Union,

"Recommendation E.164/ I.331--The international public telecommunication numbering plan," May 1997. http://www.itu.int/itudoc/itu-t/rec/e/s_e164.html

[Kurose 1996] J. F. Kurose, Unix Network Programming. http://manic.cs.umass.edu/~amldemo/courseware/intro.html

[Luotonen 1998] A. Luotonen, Web Proxy Servers, Prentice Hall, Englewood Cliffs, New Jersey, 1998. 

[McKusik 1996] Marshall Kirk McKusick, Keith Bostic, Michael Karels, and John Quarterman, The Design and Implementation of the 4.4BSD Operating System, Addison-Wesley, Reading, MA, 1996. 

[Netcraft 2000] The Netcraft Web Server Survey, Netcraft Web Site, http://www.netcraft.com/survey/

References and Hyperlinks5References and Hyperlinks5

Page 242: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-296296April 19, 2023

[Netscape Cookie 1999] Netscape, "Persistent Client State http Cookies. http://home.netscape.com/newsref/std/cookie_spec.html

[Nielsen 1997] H. F. Nielsen, J. Gettys, A. Baird-Smith, E. Prud'hommeaux, H. W. Lie, and C. Lilley, "Network Performance Effects of HTTP/1.1, CSS1, and PNG," W3C Document, 1997 (also appears in Proceedings of ACM SIGCOMM '97, Cannes, France, pp. 155-166 ). http://www.acm.org/sigcomm/sigcomm97/papers/p102.html

[NLANR 1999] A Distributed Testbed for National Information Provisioning, http://ircache.nlanr.net/

[Padhye 1999] J. Padhye and J. Kurose, "An Empirical Study of Client Interactions with a Continuous-Media Courseware Server," IEEE Internet Computing, Apr. 1999. ftp://gaia.cs.umass.edu/pub/Padh97:Empirical.ps.gz

[Ramjee 1994] R. Ramjee, J. Kurose, D. Towsley, and H. Schulzrinne, "Adaptive Playout Mechanisms for Packetized Audio Applications in Wide-Area Networks," Proceeding IEEE Infocom 94. ftp://gaia.cs.umass.edu/pib/Ramj94:Adaptive.ps.Z

[RFC 821] J. Postel, "Simple Mail Transfer Protocol," RFC 821, Aug. 1982. http://www.rfc-editor.org/rfc/rfc821.txt

References and Hyperlinks6References and Hyperlinks6

Page 243: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-297297April 19, 2023

[RFC 854] J. Postel and J. Reynolds, "TELNET Protocol Specification," RFC 854. May 1993. http://www.rfc-editor.org/rfc/rfc854.txt

[RFC 959] J. Postel and J. Reynolds, "File Transfer Protocol (FTP)," RFC 959, Oct. 1985. http://www.rfc-editor.org/rfc/rfc959.txt

[RFC 1034] P. V. Mockapetris, "Domain Names--Concepts and Facilities," RFC 1034, Nov. 1987. http://www.rfc-editor.org/rfc/rfc1034.txt

[RFC 1035] P. Mockapetris, "Domain Names--Implementation and Specification," RFC 1035, Nov. 1987. http://www.rfc-editor.org/rfc/rfc1035.txt

[RFC 1945] T. Berners-Lee, R. Fielding, H. Frystyk, "Hypertext Transfer Protocol--HTTP/1.0," RFC 1945, May 1996 http://www.rfc-editor.org/rfc/rfc1945.txt

[RFC 2045] N. Freed, N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies," RFC 2045, Nov. 1996. http://www.rfc-editor.org/rfc/rfc2045.txt

References and Hyperlinks7References and Hyperlinks7

Page 244: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-298298April 19, 2023

[RFC 2046] N. Freed, N. Borenstein,, "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types," RFC 2046, Nov. 1996. http://www.rfc-editor.org/rfc/rfc2046.txt

[RFC 2068] R. Fielding, J. Gettys, J. Mogul, H. Frystyk, and T. Berners-Lee, "Hypertext Transfer Protocol--HTTP/1.1," RFC 2068, Jan. 1997. http://www.rfc-editor.org/rfc/rfc2068.txt. Obsoleted by RFC 2616. 

[RFC 2186] K. Claffy and D. Wessels, "Internet Caching Protocol (ICP), version 2," RFC 2186, Sept. 1997. http://www.rfc-editor.org/rfc/rfc2186.txt

[RFC 2616] R. Fielding, J. Gettys, J. Mogul, H. Frystyk, L. Masinter, P. Leach, T. Berners-Lee, R. Feilding, "Hypertext Transfer Protocol--HTTP/1.1," RFC 2616, June 1999. http://www.rfc-editor.org/rfc/rfc2616.txt

[Ross 1997] K. W. Ross, "Hash-Routing for Collections of Shared Web Caches," IEEE Network Magazine, Vol. 11 (Nov.-Dec. 1997), pp. 37-45. 

[Ross 1998] K. W. Ross, Distribution of Stored Information in the Web, An Online Tutorial, http://www.eurecom.fr/~ross/CacheTutorial/DistTutorial.html, 1998. 

References and Hyperlinks8References and Hyperlinks8

Page 245: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-299299April 19, 2023

[Schurmann 1996] G. Schurmann, "Multimedia Mail," ACM Multimedia Systems, Oct. 1996, pp. 281-295. 

[Squid 2000] Squid Web Proxy Cache, http://www.squid-cache.org/ [Stevens 1997] W.R. Stevens, Unix Network Programming, Volume 1:

Networking APIs-Sockets and XTI, 2nd edition, Prentice-Hall, Englewood Cliffs, NJ, 1997. 

[Turner 1999] D. A. Turner and K. W. Ross, "Continuous-Media Internet E-Mail: Infrastructure Inadequacies and Solutions," http://www.eurecom.fr/~turner/cmail1.html

[Valloppillil 1997] V. Valloppillil and K. W. Ross, "Cache Array Routing Protocol," Internet Draft, <draft-vinod-carp-v1-03.txt>, June 1997. 

[Yeager 1996] N. J. Yeager and R. E. McGrath, Web Server Technology, Morgan Kaufmann Publishers, San Francisco, 1996. © 2000-2001 by Addison Wesley LongmanA division of Pearson Education

References and Hyperlinks9References and Hyperlinks9

Page 246: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-300300April 19, 2023

P2P-Working groups et al.P2P-Working groups et al.

A generic site on p2p from O'Reilly www.openp2p.com

P2P working group www.peer-to-peerwg.org/

Internet2 p2p working group p2p.internet2.edu

Peer-to-peer development (p2p-hackers) zgp.org/mailman/listinfo/p2p-hackers

Interesting meeting www.codecon.org

Page 247: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-301301April 19, 2023

P2P-References-1P2P-References-1

Distributed Computing Distributed (www.distributed.net) SETI@home (www.seti.org) Genome@home (gah.stanford.edu) Folding@home (www.stanford.edu/group/pandegroup/folding) Global Grid Forum (www.globalgridforum.org) Globus Project (www.globus.org)

File sharing Napster (www.napster.com) Gnutella (gnutella.wego.co) Kazaa (www.kazaa.com)

Page 248: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-302302April 19, 2023

P2P-References-2P2P-References-2

Distributed hash tables CAN (www.acm.org/sigs/sigcomm/sigcomm2001/p13-

ratnasamy.pdf) Pastry (research.microsoft.com/~antr/Pastry) Chord (www.pdos.lcs.mit.edu/chord) Tapestry (www.cs.berkeley.edu/~ravenben/tapestry) Freenet (freenet.sourceforge.net) Kademlia (kademlia.scs.cs.nyu.edu)

Ad hoc networking AODV (www.ietf.org/internet-drafts/draft-ietf-manet-aodv-

13.txt) OLSR (www.ietf.org/internet-drafts/draft-ietf-manet-olsr-10.txt) Tribe (rp.lip6.fr/site_rp/_publications/350-79Viana.ps.gz)

Page 249: Ali.dmohammadi @gmail.comApplication Layer ali.dmohammadi @gmail.comApplication Layer 2-1 August 26, 2015. Application Layer Computer Networks Shahrood

[email protected]@gmail.com Application LayerApplication Layer 2-2-303303April 19, 2023

P2P-References-3P2P-References-3

Platforms JXTA (www.jxta.org) .NET (www.microsoft.com/net)

Collaboration Groove (www.groove.net) Endeavors (www.endeavors.com)

IPv6 as a p2p overlay Working Groups

p2p.internet2.edu www.openp2p.com