+ All Categories
Home > Documents > Kuliah_03 - Application Layer (HTTP, FTP)

Kuliah_03 - Application Layer (HTTP, FTP)

Date post: 23-Feb-2018
Category:
Upload: hery-nugroho
View: 222 times
Download: 0 times
Share this document with a friend

of 47

Transcript
  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    1/47

    Application Layer 2-1

    Chapter 2

    ApplicationLayer

    ComputerNetworking: ATop Down

    Approach

    6th

    editionJim Kurose, KeithRossAddison-WesleyMarch 2012

    A note on the use of these ppt slides:Were making these slides freely available to all (faculty, students, readers).

    Theyre in o!eroint form so you see the animations" and can add, modify,

    and delete slides (including this one) and slide content to suit your needs.

    They obviously represent a lotof !ork on our part. #n return for use, !e only

    ask the follo!ing:

    #f you use these slides (e.g., in a class) that you mention their source

    (after all, !ed like people to use our book$) #f you post any slides on a !!! site, that you note that they are adapted

    from (or perhaps identical to) our slides, and note our copyright of this

    material.

    Thanks and en%oy$ &'W*

    All material copyright +-/0+/ &.' urose and .W. *oss, All *ights *eserved

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    2/47

    Application Layer 2-2

    Chapter 2 outline

    2!1 principles o"net#or$applications

    2!2 We% and &''(2!) *'(

    2!+ electronic mail

    M'(, ((),.MA(

    2!/

    2.6 P2P applications

    2.7 socket programming

    with UDP and TCP

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    3/47

    Application Layer 2-)

    Chapter 2 applicationlayer

    our oals conceptual,

    implementationaspects o" net#or$

    applicationprotocols

    transport-layerser3ice models

    client-ser3erparadim

    peer-to-peerparadim

    learn about protocols byexamining popular

    applicationle!el

    protocols

    &''( *'(

    M'( 4 (() 4 .MA(

    creating network

    applications

    soc$et A(.

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    4/47

    Application Layer 2-+

    ome net#or$ apps

    e-mail #e% te5t messain

    remote loin (2( le sharin multi-user net#or$

    ames

    streamin stored3ideo 78ou'u%e, &ulu,et9i5:

    !oice o!er "P #e.g.$ %kype&

    realtime !ideo con'erencing

    social networking

    search

    (

    (

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    5/47

    Application Layer 2-/

    Creatin a net#or$ app

    #rite prorams that run on 7di;erent: end

    systems communicate o3er

    net#or$

    e!!, #e% ser3erso"t#are communicates#ith %ro#ser so"t#are

    no need to #rite so"t#are

    "or net#or$-corede3ices net#or$-core de3ices

    do not run userapplications

    applications on ends stems allo#s "or

    application

    transport

    net!ork

    data link

    physical

    application

    transport

    net!ork

    data link

    physical

    application

    transport

    net!ork

    data link

    physical

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    6/47

    Application Layer 2-6

    Application architectures

    possi%le structure o" applications client-ser3er peer-to-peer 7(2(:

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    7/47Application Layer 2-uest ser3ice

    "rom other peers,

    pro3ide ser3ice inreturn to other peers

    self scalability?ne# peers %rin

    ne# ser3icecapacity, as #ell asne# ser3icedemands

    peers are

    intermittently

    peerpeer

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    9/47Application Layer 2-@

    (rocesses communicatin

    process:proramrunnin #ithin ahost

    #ithin same host, t#oprocessescommunicate usininter-processcommunication7dened %y :

    processes in di;erenthosts communicate%y e5chanin

    messaes

    client process:process thatinitiates communication

    server process:processthat waits to be contacted

    aside applications

    #ith (2( architecturesha3e client processes ser3er processes

    clients, ser3ers

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    10/47

    Application Layer 2-10

    oc$ets

    process sends4recei3es messaes to4"rom itssoc$et soc$et analoous to door

    sendin process sho3es messae out door

    sendin process relies on transportin"rastructure on other side o" door to deli3ermessae to soc$et at recei3in process

    #nternet

    controlled

    by 12

    controlled byapp developer

    transport

    application

    physical

    lin$

    net#or$

    process

    transport

    application

    physical

    lin$

    net#or$

    processsocket

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    11/47

    Application Layer 2-11

    Addressin processes

    to recei!e messages$ processmust ha!e identifier

    host de!ice has uni*ue +2bit

    "P address

    Q:does "P address o' host onwhich process runs su''ice

    'or identi'ying the process,

    identierincludes %oth.( addressand portnum%ersassociated#ith process on host!

    e5ample port num%ers &''( ser3er =0

    mail ser3er 2/

    to send &''( messaeto aia!cs!umass!edu#e% ser3er .( address

    12=!11@!2+/!12

    port num%er=0

    more shortlyB

    A:no, manyprocesses can %e

    runnin on samehost

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    12/47

    Application Layer 2-12

    App-layer protocol denes

    types o" messaese5chaned,

    e!!, re>uest,response

    messae synta5 #hat elds in

    messaes ho#elds are

    delineated messae semantics

    meanin o"in"ormation in

    elds

    open protocols)de'ined in -Cs

    allows 'or interoperability

    e.g.$ /TTP$ %0TP

    proprietary protocols)e.g.$ %kype

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    13/47

    Application Layer 2-1)

    What transport ser3ice does anapp needdata interity some apps 7e!!, le

    trans"er, #e%transactions: re>uire100D relia%le data

    trans"er other apps 7e!!, audio:

    can tolerate some losstimingsome apps #e.g.$ "nternet

    telephony$ interacti!egames& re*uire low delayto be 1e''ecti!e

    throuhput some apps 7e!!,

    multimedia: re>uireminimum amount o"throuhput to %eEe;ecti3eF

    other apps 7EelasticappsF: ma$e use o"#hate3er throuhputthey et

    security encryption, data

    interity, B

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    14/47

    Application Layer 2-1+

    'ransport ser3ice re>uirementscommon apps

    application

    file transfer

    email

    Web documentsrealtime audiovideo

    stored audiovideo

    interactive games

    te3t messaging

    data loss

    no loss

    no loss

    no losslosstolerant

    losstolerant

    losstolerant

    no loss

    throughput

    elastic

    elastic

    elasticaudio: 4kbps+5bps

    video:+0kbps45bps

    same as above

    fe! kbps up

    elastic

    time sensitive

    no

    no

    noyes, +00s msec

    yes, fe! secs

    yes, +00s msec

    yes and no

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    15/47

    Application Layer 2-1/

    .nternet transport protocolsser3ices

    TCP service: reliable transport

    %et#een sendin andrecei3in process

    ow control:sender#onGt o3er#helmrecei3er

    congestion control:throttle sender #hennet#or$ o3erloaded

    does not provide:timin, minimumthrouhput uarantee,security

    connection!oriented:setup re>uired%et#een client and

    UDP service:unreliable data transfer

    between sending and

    recei!ing process

    does not provide:reliability$'low control$ congestion

    control$ timing$

    throughput guarantee$

    security$ or connectionsetup$

    3)why bother, 4hy is

    there a UDP,

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    16/47

    Application Layer 2-16

    .nternet apps application, transportprotocols

    application

    email

    remote terminal access

    Webfile transfer

    streaming multimedia

    #nternet telephony

    applicationlayer protocol

    25T 6*'7 /8/+9

    Telnet 6*'7 849

    ;TT 6*'7 /-+-9'T 6*'7 49

    ;TT (e.g.,

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    17/47

    ecurin 'C(

    'C( H( no encryption clearte5t pass#ds

    sent into soc$ettra3erse .nternetin clearte5t

    L pro3ides

    encrypted 'C(connection

    data interity

    %%5 is at app layer

    pps use %%5 libraries$

    which 1talk to TCP

    %%5 socket P" clearte5t pass#ds

    sent into soc$ettra3erse .nternet

    encrypted ee Chapter uest messae AC.. 7human-reada%le "ormat:

    re?uest line(@T, 12T,

    ;A> commands:

    header

    lines

    carriage return,

    line feed at start

    of line indicates

    end of header lines

    GET /index.html HTTP/1.1\r\nHost: www-net.cs.umass.edu\r\nser-!"ent: #ire$ox/%.&.1'\r\n!ccept: text/html(application/xhtml)xml\r\n!ccept-*an"ua"e: en-us(en+,'.\r\n

    !ccept-Encodin": "ip(de$late\r\n!ccept-0harset: S2-334-1(ut$-3+,'.5\r\n6eep-!li7e: 11\r\n0onnection: 8eep-ali7e\r\n\r\n

    carriage return character

    linefeed character

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    28/47

    Application Layer 2-2=

    &''( re>uest messae eneral"ormat

    re?uestline

    header

    lines

    body

    method sp sp cr lfversion=*B

    cr lfvalueheader field name

    cr lfvalueheader field name

    CC CC

    cr lf

    entity bodyCC CC

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    29/47

    Application Layer 2-2@

    Hploadin "orm input

    (' method #e% pae o"ten

    includes "orm input input is uploaded to

    ser3er in entity %odyU-5 method)uses =>T method

    input is uploaded in U-5

    'ield o' re*uest line)www.somesite.com/animalsearch9mon8es;

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    30/47

    Application Layer 2-)0

    Methodtypes&''(41!0 ' ('

    &A as$s ser3er to

    lea3e re>uestedo%Iect out o"

    response

    /TTPT$ P?%T$ />D

    PUT

    uploads le inentity %ody topath specied inHRL eld

    D>5>T>

    deletes lespecied in theHRL eld

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    31/47

    Application Layer 2-)1

    &''( response messae

    status line(protocol

    status code

    status phrase)

    header

    lines

    data, e.g.,

    re?uested

    ;T5B file

    HTTP/1.1 ='' 26\r\nDate: Sun( =& Sep ='1' =':'4:=' G>T\r\nSer7er: !pache/=.'.= ?0ent2S@\r\n*ast->odi$ied: Tue( %' 2ct =''5 15:'':'=

    G>T\r\nETa": A15dc&-ac-

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    32/47

    Application Layer 2-)2

    &''( response status codes

    ='' 26

    re>uest succeeded, re>uested o%Iect later in this ms%'1 >o7ed Permanentl

    re>uested o%Iect mo3ed, ne# location specied later inthis ms 7Location:

    C'' ad Be,uest

    re>uest ms not understood %y ser3erC'C ot #ound

    re>uested document not "ound on this ser3er

    ' HTTP Fersion ot Supported

    status code appears in +st line in servertoclient response message.

    some sample codes:

    ' i &''( 7 li id : "

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    33/47

    Application Layer 2-))

    'ryin out &''( 7client side: "oryoursel"

    1! 'elnet to your "a3orite We% ser3er

    opens T7 connection to port 80

    (default ;TT server port) at cis.poly.edu.

    anything typed in sent

    to port 80 at cis.poly.edu

    telnet cis.pol.edu 3'

    /. type in a @T ;TT re?uest:

    GET /ross/ HTTP/1.1

    Host: cis.pol.edu

    by typing this in (hit carriage

    return t!ice), you send

    this minimal (but complete)@T re?uest to ;TT server

    D. look at response message sent by ;TT server$

    se Wireshar$ to loo$ at captured &''( re>uest4response:

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    34/47

    Application Layer 2-)+

    Hser-ser3er state coo$ies

    many We% sites usecoo$ies

    four components:

    1: coo$ie header line

    o" &''( responsemessae

    2: coo$ie headerline in ne5t &''(re+uestmessae

    ): coo$ie le $epton userGs host,manaed %yuserGs %ro#ser

    +: %ac$-end

    data%ase at We%

    example)%usan always access "nternet

    'rom PC

    !isits speci'ic ecommerce site

    'or 'irst time

    when initial /TTP re*uests

    arri!es at site$ site creates)

    uni>ue .

    entry in %ac$enddata%ase "or .

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    35/47

    Application Layer 2-)/

    Coo$ies $eepin EstateF 7cont!:

    client server

    usual http response msg

    usual http response msg

    cookie file

    one !eek later:

    usual http re?uest msgcookie: 1678

    cookie

    specific

    action

    access

    ebay 8734usual http re?uest msg AmaEon server

    creates #>

    +-F8 for user create

    entry

    usual http responseset-cookie: 1678

    ebay 8734amazon 1678

    usual http re?uest msgcookie: 1678 cookie

    specific

    action

    access

    ebay 8734

    amazon 1678

    backend

    database

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    36/47

    Application Layer 2-)6

    Coo$ies 7continued:

    what cookies canbe used for: authoriOation shoppin carts recommendations user session state

    7We% e-mail:

    cookies and privacy: coo$ies permit sites

    to learn a lot a%outyou

    you may supplyname and e-mail tosites

    aside

    how to keep ,state-: protocol endpoints maintain

    state at sender4recei3er o3ermultiple transactions

    coo$ies http messaes carrystate

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    37/47

    Application Layer 2-)uests tocache

    o%Iect in cache

    cache returnso%Iect

    else cachere>uests o%Iect

    "rom oriin ser3er,

    goal:satis"y client re>uest #ithout in3ol3inoriin ser3er

    client

    pro3y

    server

    client

    ;TT

    re?ue

    st

    ;TTrespo

    nse

    ;TTre?uest ;TT

    re?uest

    origin

    server

    origin

    server

    ;TTresponse ;TTre

    sponse

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    38/47

    Application Layer 2-)=

    More a%out We% cachin

    cache acts as%oth client andser3er

    ser3er "or oriinalre>uestin client

    client to oriin ser3er

    typically cache isinstalled %y .(7uni3ersity,company,residential .(:

    why Web caching

    reduce response time 'or

    client re*uest

    reduce tra''ic on aninstitution@s access link

    "nternet dense with caches)

    enables 1poor content

    pro!iders to e''ecti!elydeli!er content #so too

    does P2P 'ile sharing&

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    39/47

    Application Layer 2-)@

    Cachin e5ample

    origin

    serverspublic

    #nternet

    institutional

    net!ork

    + @bps BAG

    +.4 5bps

    access link

    assumptions: a3 o%Iect siOe 100K %its a3 re>uest rate "rom

    %ro#sers to oriinser3ers1/4sec

    a3 data rate to %ro#sers1!/0 M%ps

    R'' "rom institutional routerto any oriin ser3er 2 sec

    access lin$ rate 1!/+ M%ps

    conse+uences: LA utiliOation 1/D access lin$ utiliOation @@D total delay .nternet delay

    N access delay N LA delay

    2 sec N minutes N usecs

    problem!

    Cachin e5ample "atter

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    40/47

    Application Layer 2-+0

    assumptions: a3 o%Iect siOe 100K %its a3 re>uest rate "rom

    %ro#sers to oriinser3ers1/4sec

    a3 data rate to %ro#sers1!/0 M%ps

    R'' "rom institutional routerto any oriin ser3er 2 sec

    access lin$ rate 1!/+ M%ps

    conse+uences: LA utiliOation 1/D access lin$ utiliOation @@D total delay .nternet delay N

    access delay N LA delay 2 sec N minutes N usecs

    Cachin e5ample "atteraccess lin$

    origin

    servers

    +.4 5bps

    access link1/+

    M%ps+4 5bps

    msecs

    Cost:increased access link speed (not cheap$)

    @!@D

    public

    #nternet

    institutional

    net!ork

    + @bps BAG

    Cachin e5ample install local

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    41/47

    institutional

    net!ork

    + @bps BAG

    Application Layer 2-+1

    Cachin e5ample install localcache

    origin

    servers

    +.4 5bps

    access link

    local !ebcache

    assumptions: a3 o%Iect siOe 100K %its a3 re>uest rate "rom

    %ro#sers to oriinser3ers1/4sec

    a3 data rate to %ro#sers1!/0 M%ps

    R'' "rom institutional routerto any oriin ser3er 2 sec

    access lin$ rate 1!/+ M%ps

    conse+uences: LA utiliOation 1/D access lin$ utiliOation 100D total delay .nternet delay N

    access delay N LA delay 2 sec N minutes N usecs

    HH

    &ow to compute linkutili.ation# delay/

    Cost:!eb cache (cheap$)

    public

    #nternet

    Cachin e5ample install local

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    42/47

    Application Layer 2-+2

    Cachin e5ample install localcache

    Calculating access linkutili.ation# delay withcache:

    suppose cache hit rate is0!+ +0D re>uests satised at

    cache, 60D re>uestssatised at oriin

    origin

    servers

    +.4 5bps

    access link

    access lin$ utiliOation 60D o" re>uests use access lin$

    data rate to %ro#sers o3eraccess lin$ 0!6P1!/0 M%ps !@ M%ps utiliOation 0!@41!/+ !/=

    total delay 0!6 P 7delay "rom oriinser3ers: N0!+ P 7delay #hensatised at cache:

    0!6 72!01: N 0!+ 7Qmsecs: Q 1!2 secs less than #ith 1/+ M%ps lin$

    7and cheaper too:

    public

    #nternet

    institutional

    net!ork

    + @bps BAG

    local !ebcache

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    43/47

    Application Layer 2-+)

    Conditional '

    0oal:donGt sendo%Iect i" cache hasup-to-date cached3ersion no o%Iect

    transmission delay

    lo#er lin$ utiliOation

    cache:speci"y dateo" cached copy in

    &''( re>uest$-modi$ied-since:dateI

    server:responsecontains no o%Iect i"cached copy is up-

    ;TT re?uest msgI-modiied-since: !date"

    ;TT response

    #$$%&1'(3(4 )ot *odiied

    ob%ect

    not

    modified

    before

    IdateJ

    ;TT re?uest msgI-modiied-since: !date"

    ;TT response#$$%&1'( +(( ,

    !data"

    ob%ect

    modified

    after

    IdateJ

    client !eb cache

    server

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    44/47

    Application Layer 2-++

    Chapter 2 outline

    2!1 principles o"net#or$applications

    app architectures app re>uirements

    2!2 We% and &''(

    2!) *'(

    2!+ electronic mail M'(, ((),

    .MA(

    2!/

    2!6 (2( applications

    2!< soc$etprorammin

    #ith H( and 'C(

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    45/47

    Application Layer 2-+/

    *'( the le trans"er protocol

    file transfer

    'Tserver

    'Tuser

    interface

    'Tclient

    local file

    system

    remote file

    system

    user

    at host

    trans"er le to4"rom remote host client4ser3er model

    client:side that initiates trans"er 7eitherto4"rom remote: server:remote host

    "tp R*C @/@ "tp ser3er port 21

    *'( separate control data

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    46/47

    Application Layer 2-+6

    *'( separate control, dataconnections

    *'( client contacts *'(ser3er at port 21, usin

    'C( client authoriOed o3er

    control connection client %ro#ses remote

    directory, sendscommands o3er control

    connection #hen ser3er recei3es

    le trans"er command,serveropens 1nd'C(data connection 7"or le:to client

    'Tclient

    'Tserver

    TCP control connection,server port 21

    TCP data connection,server port 20

    ser3er opens another'C( data connection totrans"er another le

    control connection,out of band-

    *'( ser3er maintainsEstateF currentdirectory, earlierauthentication

  • 7/24/2019 Kuliah_03 - Application Layer (HTTP, FTP)

    47/47

    *'( commands, responses

    sample commands: sent as AC.. te5t

    o3er control channel SEB username

    P!SS password *STreturn list o" le

    in current directory

    BETB $ilenameretrie3es 7ets: le

    ST2B $ilenamestores 7puts: le ontoremote host

    sa!ple return codesstatus code and phrase #as in

    /TTP&

    %%1 sername 26(

    password re,uired

    1= data connection

    alread open+

    trans$er startin"

    C= 0anJt open data

    connectionC= Error writin"

    $ile


Recommended