Cis81 E1 4 TransportLayer Rick

Embed Size (px)

Citation preview

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    1/80

    Chapter 4

    Transport Layer

    CIS 81 Networking Fundamentals

    Rick ra!ianiCa"rillo College

    gra!iani#ca"rillo$edu

    Last %pdated& '('()**+

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    2/80

    )

    Note

    This presentation is not in the order o, the "ook or online curriculum$ This presentation also contains in,ormation "eyond the curriculum$

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    3/80

    Transport Layer -.er.iew

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    4/80

    4

    Transport Layer

    Transport Layer&

    Responsi"le ,or creating and maintaining a logical connection

    "etween the endpoints

    /hat are the two protocols at the transport layer0 TCP Transmission Control 2rotocol

    UDP %ser 3atagram 2rotocol

    TCP UDP

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    5/80

    Application

    Header + data

    TCP Header UDP Header

    or

    23%& Segment

    23%& Data

    What is the application

    PDU called?

    What is the transport

    PDU called?

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    6/80

    5

    UDP

    TCP

    TCP/UDP TCP/UDP

    The Layer 4 data stream is a& Logical connection "etween the endpoints

    2ro.ides transport ser.ices

    End-to-end service

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    7/80

    6

    DataHTTPHeader

    TCP

    Header

    P

    Header

    Data !in"

    Header

    Data !in"

    Trailer

    P Pac"etData !in"

    Header

    Data !in"

    TrailerP Pac"etData !in"

    Header

    Data !in"

    Trailer

    P Pac"etData !in"Header

    Data !in"

    TrailerP Pac"etData !in"Header

    Data !in"

    Trailer

    P Pac"etData !in"

    Header

    Data !in"

    TrailerP Pac"etData !in"

    Header

    Data !in"

    Trailer

    DataHTTP

    Header

    TCP

    Header

    P

    Header

    Data !in"

    Header

    Data !in"

    Trailer

    Reminder o, encapsulation(decapsulation

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    8/80

    8

    Focus on Transport Layer

    TCP

    TCP

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    9/80

    +

    2rimary responsi"ilities&

    Tracking the indi.idual communication "etween applications

    /ho is the client0 /hich application0 /hich process0

    Identi,ying the di,,erent applications 7TT29 FT29 etc$:

    Segmenting data

    ;anaging each segment

    Reassem"ling the segments

    Transport Layer

    www$cisco$com

    TCP Segment

    TCP Segment

    TCP Segment

    TCP Segment

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    10/80

    1*

    /hat two protocols are at the Transport Layer0 TCP

    UDP

    Pis a "est

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    11/80

    11

    TC2 .s$ %32

    TC2 pro.ides&

    Relia"le deli.ery

    Brror checking

    Flow control

    Congestion control

    -rdered deli.ery

    Connection esta"lishment

    pplications&

    TT2

    FT2

    Telnet

    ;SN messenger

    %32 pro.ides&

    %nrelia"le deli.ery

    No error checking

    No ,low control

    No congestion control

    No ordered deli.ery

    No connectionesta"lishment

    pplications

    3NS 7usually:

    S;T2

    3C2

    RT2 7Real

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    12/80

    1)

    single clientmay ha.e multiple transport connections with multipleser.ers$

    Notice that TCP is a connection-orientedser.ice 7two

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    13/80

    2ort Num"ers& TC2 and %32

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    14/80

    14

    3oth TCP and UDPuse ports 7or sockets: num"ers to pass in,ormation to the

    upper layers$

    0 15 16 31

    16-bit Source Port Number 16-bit Destination Port Number

    32-bit Sequence Number

    32 bit Acknowledgement Number

    -bit !eader

    "engt#

    6-bit

    $%eser&ed'

    (%

    )

    A*

    +

    PS

    !

    %S

    ,

    S

    N

    ./

    N16-bit indow Sie

    16-bit ,*P *#ecksum 16-bit (rgent Pointer

    tions $i4 an'

    Data $i4 an'

    TCP Header

    HTTP is Port 45

    UDP Header

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    15/80

    1

    The application this TCP

    segment came (rom

    The application this TCP

    segment is going to

    The application this TCP

    segment came (rom

    The application this TCP

    segment is going to

    http://www.apache.org/http://www.apache.org/
  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    16/80

    15

    Application

    Header + dataPort n%m)ers are %sed )#

    the receiver so it "no$s

    $hich application it sho%ld

    send the &Data' to

    Application

    Header + dataPort n%m)ers are %sed to

    )# the sender to tell the

    receiver $hich net$or"

    application it sho%ld %se

    (or the &Data'

    Port 6%m)er

    Port 6%m)er

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    17/80

    16

    http&((www$iana$org(assignments(port

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    18/80

    18

    Well 7no$n Ports 6%m)ers 5 to 859:

    Reser.ed ,or common ser.ices and

    applications

    Client& TC2 destination port

    Server& TC2 source port

    Well 7no$n or ;egistered

    Port 6%m)er

    Well 7no$n or ;egistered

    Port 6%m)er

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    19/80

    1+

    Well 7no$n or ;egisteredPort 6%m)er

    Well 7no$n or ;egistered

    Port 6%m)er

    ;egistered Ports 6%m)ers 859< to 8

    ssigned to user processes orapplications$

    Non

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    20/80

    )*

    D#namic or Private Ports 6%m)ers 9 to >>:>

    lso known as Bphemeral 2orts

    %sually assigned dynamically to client applications when initiating a

    connection$

    Client& TC2 source port

    Server& TC2 destination port

    ;ay also include the range o, Registered 2orts 7Num"ers 1*)4 to

    4+11:

    Well 7no$n or ;egistered

    Port 6%m)er

    Private/D#namic Port

    6%m)er

    Well 7no$n or ;egistered

    Port 6%m)er

    Private/D#namic Port

    6%m)er

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    21/80

    )1

    Client Server

    Telnet

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    22/80

    ))

    Client sends TC2 segment with&

    3estination 2ort& )'7/ell known port num"er:

    Source 2ort& 1*)873ynamic 2ort assigned "y client:

    Client TCP Header0 15 16 31

    16-bit Source Port Number 16-bit Destination Port Number

    32-bit Sequence Number

    32 bit Acknowledgement Number

    -bit !eader"engt#

    6-bit$%eser&ed'

    (%

    )

    A*

    +

    PS

    !

    %S

    ,

    S

    N

    ./

    N16-bit indow Sie

    16-bit ,*P *#ecksum 16-bit (rgent Pointer

    tions $i4 an'

    Data $i4 an'

    9:8594

    Data (or Telnet

    Client Server

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    23/80

    )'

    Ser.er responds with TC2 segment with&

    3estination 2ort& 1*)873ynamic 2ort assigned "y client:

    Source 2ort& )'7/ell known port num"er:

    Server TCP Header0 15 16 31

    16-bit Source Port Number 16-bit Destination Port Number

    32-bit Sequence Number

    32 bit Acknowledgement Number

    -bit !eader"engt#

    6-bit$%eser&ed'

    (%

    )

    A*

    +

    PS

    !

    %S

    ,

    S

    N

    ./

    N16-bit indow Sie

    16-bit ,*P *#ecksum 16-bit (rgent Pointer

    tions $i4 an'

    Data $i4 an'

    85949:

    Data (or Telnet

    Client Server

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    24/80

    )4

    Notice the di,,erence in how source and destination port num"ers areused with clients and ser.ers&

    Client initiating Telnet service@

    3estination 2ort E )' 7telnet: Source 2ort E 1*)8 7dynamically assigned:

    Server responding to Telnet service@

    3estination 2ort E 1*)8 7source port o, client:

    Source 2ort E )' 7telnet:

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    25/80

    )

    Same client to same ser.er < Two di,,erent TT2 sessions

    Client& Same destination port

    Client& 3i,,erent source ports to uniuely identi,y this we" session$

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    26/80

    )5

    C:\Users\rigrazia>netstat -n

    Active Connections

    Proto Local Address Foreign Address State

    TCP 192.16.1.1!1:"9 19.1##.219.2$:! T%&'()A%T

    TCP 192.16.1.1!1:"99! 19.1##.219.2$:! T%&'()A%T

    C:\Users\rigrazia>

    TCP

    or

    UDP

    So%rce Port

    Destination P

    Destination Port Connection State

    So%rce P

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    27/80

    )6

    What makes each connection unique? How does the server knowwhich source port 49888 is who?

    Connection de,ined "y the pair o, num"ers& So%rce P address9 So%rce port 7From Client to Ser.er: Destination P address9 Destination port7From Ser.er to

    Client: 3i,,erent connections can use the same destination port on ser.er

    host as long as the source ports or source I2s are di,,erent$

    8=9848858

    898>>

    Destination

    Port

    45

    45

    45

    So%rce

    Port

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    28/80

    )8

    6ote@ /hen downloading a we" document and its o"Gects it is common that

    there will "e se.eral TC2 sessions created$

    netstat Bn$$$ciscocom$$$googlecom

    TCP

    or

    UDP So%rce Port

    Destination P

    Destination Port

    Connection StateSo%rce P

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    29/80

    )+

    %sing NetStat

    -pen a we" "rowser$

    -pen a command prompt window 7Start

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    30/80

    Connectionless Transport& %32

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    31/80

    '1

    UDP

    /hat do you notice looking at the %32 protocol0

    No ,rills9 "are"ones transport protocol$

    3estination and Source 2orts

    Length and Checksum 7used ,or error checking:

    RFC 658

    Connectionless transport

    No >handshaking? 7no connection esta"lishment: as with TC2 7coming:

    %nrelia"le deli.ery

    No error checking

    No ,low control

    No congestion control

    No ordered deli.ery

    0 15 16 31

    16-bit Source Port Number 16-bit Destination Port Number

    16-bit (DP "engt# 16-bit (DP *#ecksum

    Data $i4 an'?

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    32/80

    ')

    %32

    so%rce port

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    33/80

    ''

    %32

    Why would an application developer choose UDP rather than TP? 0iner application-la#er control

    TC2 will continue to resend segments that are not acknowledged$

    pplications that use %32 can tolerate some data loss&

    Streaming .ideo

    DoI2 7Doice o.er I2:

    pplication decides whether or not to resend entire ,ile& TFT2

    0 15 16 31

    16-bit Source Port Number 16-bit Destination Port Number

    16-bit (DP "engt# 16-bit (DP *#ecksum

    Data $i4 an'

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    34/80

    '4

    %32

    6o connection esta)lishment

    TC2 uses a three

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    35/80

    '

    %32

    6o connection state

    %32 does not maintain connection state as does TC2 7coming:

    %sed ,or relia"ility and ,low control$

    Ser.er can support more acti.e clients when not maintaining state

    in,ormation

    Small pac"et header overhead

    TC2 header has )* "ytes o, o.erhead$

    %32 header has only 8 "ytes o, o.erhead

    0 15 16 31

    16-bit Source Port Number 16-bit Destination Port Number

    16-bit (DP "engt# 16-bit (DP *#ecksum

    Data $i4 an'

    Time

    %32segment

    %32segment

    %32segment

    %32segment

    Client Server

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    36/80

    '5

    Note on %32

    6ote@ 1%ltimedia Applications and UDP

    There is an issue 7contro.ersy: with multimedia applications o.er%32$

    %32 o,,ers no congestion control 7as we will see with TC2:

    Congestion control is needed to pre.ent the network ,rom entering andstaying in a congested state$

    I, all applications were using %329 "ecause o, congestion9 .ery ,ew%32 packets would "e deli.ered and this would also cause TC2 tra,,icrates to dramatically decrease$

    ;any applications gi.e you a choice o, TC2 or %32$

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    37/80

    '6

    -nline aming

    ame data Ser.er and client need make sure all data 7mo.es9

    actions9 etc: reach the other end relia"ly$

    Doice chat Some missing data can "e tolerated 7up to a point:$

    Retransmission would cause delay$

    uestion& 3o the /orld

    o, /arcra,t ser.ers

    use TC2 or %320

    nswer& TC2 ,or game

    data9 %32 ,or .oicechat$

    /hy0

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    38/80

    '8

    %32 Checksum 7FJI:

    %32 checksum pro.ides error detection9 any changed "its or missing segments$ Simpli,ied e@planation 7see RFC 1*61 ,or more details:& Sender

    %32 adds 15 "it KwordsA keeping a c%m%lative s%m

    2er,orms ones complemento, the sum o, all the 15

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    39/80

    '+

    %32 Checksum 7FJI:

    /hat i, there is an error0 %32 does nothing to reco.er the error$ It is up to the application layer protocol 7e@ample TFT2: to decide what to do9

    such as prompt the user to download(upload the entire ,ile again$

    0 15 16 31

    16-bit Source Port Number 16-bit Destination Port Number

    16-bit (DP "engt# 16-bit (DP *#ecksum

    Data $i4 an'

    Time

    %32segment

    %32segment

    %32segment

    %32segment

    Client Server

    Cumulative Sum: 1100101011001010

    1s complement: 0011000100110101

    Total: 1111101111111111

    FinalChecksum

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    40/80

    4*

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    41/80

    Connection

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    42/80

    4)

    TCP

    TC2 pro.ides relia"le deli.ery on top o, unrelia"le I2

    TC2 pro.ides&

    Relia"le deli.ery

    Brror checking

    Flow control

    Congestion control

    -rdered deli.ery

    Connection esta"lishment

    0 15 16 31

    16-bit Source Port Number 16-bit Destination Port Number

    32-bit Sequence Number

    32 bit Acknowledgement Number

    -bit !eader"engt#

    6-bit$%eser&ed'

    (%

    )

    A*

    +

    PS

    !

    %S

    ,

    S

    N

    ./

    N16-bit indow Sie

    16-bit ,*P *#ecksum 16-bit (rgent Pointer

    tions $i4 an'

    Data $i4 an'

    0 15 16 31

    bi b bi i i b

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    43/80

    4'

    TC2

    so%rce port

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    44/80

    44

    TCP@ Connection Esta)lishment

    0or a connection to )e esta)lished9 the two end stations must synchroni!e

    on each others TC2 initial se.%ence n%m)ers S6s

    Se.%ence n%m)ers&

    Track the order o, packets Bnsure that no packets are lost in transmission$

    The initial se.%ence n%m)eris the starting num"er used when a TC2

    connection is esta"lished$

    B@changing "eginning seuence num"ers during the connection seuence

    ensures that lost data can "e reco.ered$

    0 15 16 31

    16-bit Source Port Number 16-bit Destination Port Number

    32-bit Sequence Number

    32 bit Acknowledgement Number

    -bit !eader"engt#

    6-bit$%eser&ed'

    (

    %

    )

    A

    *

    +

    P

    S

    !

    %

    S

    ,

    S

    N

    .

    /

    N16-bit indow Sie

    16-bit ,*P *#ecksum 16-bit (rgent Pointer

    tions $i4 an'

    Data $i4 an'

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    45/80

    4

    Three

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    46/80

    45

    Three

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    47/80

    46

    Three

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    48/80

    48 Step 8@ Client sends S6* SEFG4>: last (o%r digits

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    49/80

    4+ Step 9@ Server responds $ith AC7G4>

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    50/80

    *

    Step :@ Client sends AC7G8=

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    51/80

    1

    Client no$ sends HTTP ;e.%est ET to We) Server

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    52/80

    )

    TC2& Connection Termination

    1$ /hen the client has no more data to send in the stream9 it sends a segment

    with the 06 (lag set$

    )$ The ser.er sends an AC7to acknowledge the receipt o, the FIN to terminate

    the session ,rom client to ser.er$'$ The ser.er sends a 06to the client9 to terminate the ser.er to client session$

    4$ The client responds with an AC7to acknowledge the FIN ,rom the ser.er$

    0 15 16 31

    16-bit Source Port Number 16-bit Destination Port Number

    32-bit Sequence Number

    32 bit Acknowledgement Number

    -bit !eader"engt#

    6-bit$%eser&ed'

    (

    %

    )

    A

    *

    +

    P

    S

    !

    %

    S

    ,

    S

    N

    .

    /

    N16-bit indow Sie

    16-bit ,*P *#ecksum 16-bit (rgent Pointer

    tions $i4 an'

    Data $i4 an'

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    53/80

    '

    2acket Tracer B@ercise& TC2 Connection and

    Termination

    3ownload the ,ile& 2T

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    54/80

    4

    0lo$ Control and ;elia)ilit#

    ;elia)ilit#

    uaranteed deli.ery

    0lo$ Control Flow control makes sure these "u,,ers do not recei.e more data than

    the connection can handle$

    0 15 16 31

    16-bit Source Port Number 16-bit Destination Port Number

    32-bit Sequence Number

    32 bit Acknowledgement Number

    -bit !eader"engt#

    6-bit$%eser&ed'

    (%

    )

    A*

    +

    PS

    !

    %S

    ,

    S

    N

    ./

    N16-bit indow Sie

    16-bit ,*P *#ecksum 16-bit (rgent Pointer

    tions $i4 an'

    Data $i4 an'

    0 15 16 31

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    55/80

    0lo$ Control and ;elia)ilit#

    This $indo$ siIespeci,ies the num"er o, "ytes9 starting with the

    acknowledgment num"er9 that the recei.ing hosts TC2 layer is currently

    prepared to recei.e$

    Included in e.ery TC2 segment starting with three

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    56/80

    5

    ;eceive Windo$ Sending host can send only that amount o, data "e,ore getting an acknowledgment and

    window update ,rom this 7the recei.ing: host$

    Send Windo$ not a TCP (ield

    The TC2 Recei.e /indow si!e o, the other host$

    Client Eample

    Recei.e /indow Si!eE9*** "ytes Ser.er can only send 9*** "ytes "e,ore it recei.esan acknowledgement$

    Send /indow Si!e E 1*9*** "ytes Ser.er told the client that it can send the ser.er1*9*** "ytes "e,ore recei.ing an acknowledgment$

    ClientWindo$SiIeG>*555

    ServerWin

    do$

    SiIeG85*55

    5Ser.erAs Send

    /indow& 1*9***

    ;y Recei.e

    /indow& 1*9***;y Recei.e

    /indow& 9***

    ClientAs Send

    /indow& 9***I can send 10,000

    bytes without hearing

    an AC, and I can

    only receive !,000

    bytes at a time."

    I can send !,000

    bytes without hearing

    an AC, and I can

    only receive 10,000

    bytes at a time."

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    57/80

    6

    Flow Control and Relia"ility

    Application Data 855*555 )#tes

    8-8555 8558-9555 9558-:555 :558-

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    58/80

    8

    Se.%ence 6%m)er and Ac"no$ledgements Remote host sends TC2 segments with a Se.%ence 6%m)er$

    Note& This is the ,irst "yte in the segment$

    32-bit Sequence Number

    32 bit Acknowledgement Number

    -bit !eader"engt#

    6-bit$%eser&ed'

    (%

    )

    A*

    +

    PS

    !

    %S

    ,

    S

    N

    ./

    N16-bit indow Sie

    16-bit ,*P *#ecksum 16-bit (rgent Pointer

    tions $i4 an'

    Data $i4 an'

    ;SS , 1 *** " t

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    59/80

    +

    This is known as a

    Stop-and-Waitwindowing protocol$

    Ser.er must wait ,or

    acknowledgment

    "e,ore continuing to

    send data$

    "etter method0

    Sliding Windo$s

    3JN;IC

    Send /indow =yte&

    This is the last "yte

    that can "e sent

    "e,ore recei.ing anCM

    Client

    SBE19**1 7to )9***:

    We)

    Server

    SBE)9**1 7to '9***:

    SBE'9**1 7to 49***:

    SBE49**1 7to 9***:

    CME9**1

    SBE1 7to 19***:

    SBE59**1 7to 69***:

    SBE69**1 7to 89***:

    SBE89**1 7to +9***:

    SBE+9**1 7to 1*9***:

    CME1*9**1

    SBE9**1 7to 59***:

    J/

    ClientWindo$SiIeG>*555

    ClientWindo$SiIeG>*555

    ServerWindo

    $

    SiIeG85*555

    ServerWindo$

    SiIeG85*555

    J

    J

    Send /indow&=yte 1*9***

    Send /indow&

    =yte 19***

    ServerWindo

    $

    SiIeG85*555

    J

    SBE1*9**1 7to 119***:

    Send

    Windo$G>*555

    Clienthas a

    /indow Si!e o,

    9*** "ytes

    ClientWindo$SiIeG>*555

    ;SS o, 19*** "ytes

    S d

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    60/80

    5*

    TCP Windo$ SiIe TC2 pro.ides (%ll-

    d%ple service9which means data

    can "e ,lowing ineach direction9independent o, theother direction$

    Recei.er sendsaccepta"lewindow si!e to

    sender duringeach segmenttransmission 7,lowcontrol:

    I, too much data"eing sent9accepta"le

    window si!e isreduced I, more data can

    "e handled9accepta"lewindow si!e isincreased

    Client

    SBE19**1 )9***

    We)

    Server

    SBE)9**1

    '9***SBE'9**1

    49***SBE49**1

    9***

    CME9**1

    SBE1 19***1

    SBE59**1

    69***SBE69**1

    89***SBE89**1

    +9***SBE+9**1 1*9***

    CME1*9**1

    SBE9**1

    59***

    J/

    ClientWindo$SiIeG>*555

    ClientWindo$SiIeG>*555

    ServerWindo

    $

    SiIeG85*555

    ServerWindo$

    SiIeG85*555

    J

    J

    Send /indow&=yte 1*9***

    Send /indow&

    =yte 19***

    ServerWindo

    $

    SiIeG85*555

    J

    SBE1*9**1 119***

    Send

    Windo$G>*555

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    61/80

    51

    Sliding Windo$ Protocol

    Sliding window algorithms are a method o, ,low control ,or network data trans,ers usingthe recei.ers /indow si!e$

    The sender computes its usa"le window9 which is how much data it can immediatelysend$

    -.er time9 this sliding window mo.es to the rights9 as the recei.er acknowledges data$

    The recei.er sends acknowledgements as its TC2 recei.e "u,,er empties$

    The terms used to descri"e the mo.ement o, the le,t and right edges o, this slidingwindow are&

    1$ The le,t edge closes 7mo.es to the right: when data is sent and acknowledged$

    )$ The right edge opens 7mo.es to the right: allowing more data to "e sent$ This happenswhen the recei.er acknowledges a certain num"er o, "ytes recei.ed$

    '$ The middle edge open 7mo.es to the right: as data is sent9 "ut not yet acknowledged$

    Kctets sent6ot AC7ed

    Usa)le Windo$Can send ASAP

    Wor"ing Windo$ siIe

    Usa)le Windo$Can send ASAP

    nitial Windo$ siIe

    Sliding /indows 73ynamic or Scaling:

    0 15 16 31

    16-bit Source Port Number 16-bit Destination Port Number

    32-bit Sequence Number

    32 bit Acknowledgement Number

    TCP Header

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    62/80

    5)

    8 9 : < > 4 = 85 88 89 8:

    9

    :

    ost = gi.es ost a window si!e o, 5 7octets:$ ost "egins "y sending octets to ost =& octets 19 )9 and ' and slides itAs

    window o.er showing it has sent those ' octets$

    ost will not increase its usa"le window si!e "y '9 until it recei.es an

    CMnowldegement ,rom ost = that it has recei.ed some or all o, the octets$

    ost =9 not waiting ,or all o, the 5 octets to arri.e9 a,ter recei.ing the third octet

    sends an e@pectational CMnowledgement o, >4? to ost $

    AC7 4 = 85 88 89 8: 8 9 : < > 4 = 85 88 89 8:

    8 9 : < > 4 = 85 88 89 8:

    8

    Host A - Sender Host 3 - ;eceiver

    g

    -bit !eader"engt#

    6-bit$%eser&ed'

    (

    %)

    A

    *+

    P

    S!

    %

    S,

    S

    N

    .

    /N

    16-bit indow Sie

    16-bit ,*P *#ecksum 16-bit (rgent Pointer

    tions $i4 an'

    Data $i4 an'

    Host 3 - ;eceiverHost A - Sender

  • 8/14/2019 Cis81 E1 4 TransportLayer Rick

    63/80

    5'

    8 9 : < > 4 = 85 88 89 8:

    8 9 : < > 4 = 85 88 89 8:

    9

    :

    AC7