Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Computer Networks:
The Transport Layer

    Antonio Carzaniga

      Faculty of Informatics
      University of Lugano


 ...
Outline
Very quick intro to computer networking

The transport layer
  ◮   reliability
  ◮   congestion control
  ◮   brie...
Application




  web          web
browser       server




           c 2005–2008 Antonio Carzaniga
Application




  web          web
browser       server




           c 2005–2008 Antonio Carzaniga
Application
          GET /carzaniga/ HTTP/1.1
          Host: www.inf.unisi.ch
          ...


  web                     ...
Application




  web                                           web
browser                                        server
...
Application
          GET /carzaniga/anto.png HTTP/1.1
          Host: www.inf.unisi.ch
          ...


  web             ...
Application




  web                            web
browser                         server


          HTTP/1.1 200 OK
  ...
Transport




  web         web
browser      server




          c 2005–2008 Antonio Carzaniga
Transport




  web         web
browser      server




          c 2005–2008 Antonio Carzaniga
Transport




  web         web
browser      server




          c 2005–2008 Antonio Carzaniga
Network




  web         web
browser      server




          c 2005–2008 Antonio Carzaniga
Network




  web         web
browser      server




          c 2005–2008 Antonio Carzaniga
Network




  web         web
browser      server




          c 2005–2008 Antonio Carzaniga
Network




c 2005–2008 Antonio Carzaniga
Network




c 2005–2008 Antonio Carzaniga
Network




c 2005–2008 Antonio Carzaniga
Network




c 2005–2008 Antonio Carzaniga
Network




c 2005–2008 Antonio Carzaniga
Network




c 2005–2008 Antonio Carzaniga
Network




c 2005–2008 Antonio Carzaniga
Network




Potentially multiple paths for the same source/destination



                                                ...
Network




Potentially multiple paths for the same source/destination



                                                ...
Network




Potentially multiple paths for the same source/destination



                                                ...
Network




Potentially multiple paths for the same source/destination



                                                ...
Network




Potentially multiple paths for the same source/destination



                                                ...
Network




Potentially multiple paths for the same source/destination



                                                ...
Network




Potentially multiple paths for the same source/destination



                                                ...
Network




Potentially multiple paths for the same source/destination



                                                ...
Network




Potentially multiple paths for the same source/destination

Potentially asymmetric paths

                    ...
Network




Potentially multiple paths for the same source/destination

Potentially asymmetric paths

                    ...
Network




Potentially multiple paths for the same source/destination

Potentially asymmetric paths

                    ...
Network




Potentially multiple paths for the same source/destination

Potentially asymmetric paths

                    ...
Network




Potentially multiple paths for the same source/destination

Potentially asymmetric paths

                    ...
Network




Potentially multiple paths for the same source/destination

Potentially asymmetric paths

                    ...
A “Datagram” Network




           c 2005–2008 Antonio Carzaniga
A “Datagram” Network
Packet-switched network




                                     c 2005–2008 Antonio Carzaniga
A “Datagram” Network
Packet-switched network
  ◮   information is transmitted in discrete units called datagrams




     ...
A “Datagram” Network
Packet-switched network
  ◮   information is transmitted in discrete units called datagrams

Connecti...
A “Datagram” Network
Packet-switched network
  ◮   information is transmitted in discrete units called datagrams

Connecti...
A “Datagram” Network
Packet-switched network
  ◮   information is transmitted in discrete units called datagrams

Connecti...
A “Datagram” Network
Packet-switched network
  ◮   information is transmitted in discrete units called datagrams

Connecti...
A “Datagram” Network
Packet-switched network
  ◮   information is transmitted in discrete units called datagrams

Connecti...
A “Datagram” Network
Packet-switched network
  ◮   information is transmitted in discrete units called datagrams

Connecti...
A “Datagram” Network
Packet-switched network
  ◮   information is transmitted in discrete units called datagrams

Connecti...
A “Datagram” Network
Packet-switched network
  ◮   information is transmitted in discrete units called datagrams

Connecti...
Transport-Layer Value-Added Service




                         c 2005–2008 Antonio Carzaniga
Transport-Layer Value-Added Service
Transport-layer multiplexing/demultiplexing
  ◮   i.e., connecting applications as opp...
Transport-Layer Value-Added Service
Transport-layer multiplexing/demultiplexing
  ◮   i.e., connecting applications as opp...
Transport-Layer Value-Added Service
Transport-layer multiplexing/demultiplexing
  ◮   i.e., connecting applications as opp...
Transport-Layer Value-Added Service
Transport-layer multiplexing/demultiplexing
  ◮   i.e., connecting applications as opp...
Transport




  web         web
browser      server




          c 2005–2008 Antonio Carzaniga
Transport




  web         web
browser      server




          c 2005–2008 Antonio Carzaniga
Transport




  web         web
browser      server




          c 2005–2008 Antonio Carzaniga
Transport




  web                                          web
browser                                       server




...
Part I

Reliable Streams on Unreliable Networks




                             c 2005–2008 Antonio Carzaniga
Finite-State Machines




           c 2005–2008 Antonio Carzaniga
Finite-State Machines
A finite-state machine (FSM) is a mathematical abstraction
  ◮   a.k.a., finite-state automaton (FSA),...
Finite-State Machines
A finite-state machine (FSM) is a mathematical abstraction
  ◮   a.k.a., finite-state automaton (FSA),...
Finite-State Machines
A finite-state machine (FSM) is a mathematical abstraction
  ◮   a.k.a., finite-state automaton (FSA),...
Finite-State Machines
     x

S1        S2

     x




                c 2005–2008 Antonio Carzaniga
Finite-State Machines
                            x

                   S1               S2

                            x...
Finite-State Machines
                             x

                   S1                S2

                           ...
Finite-State Machines
                                x

                      S1                 S2

                    ...
Finite-State Machines
                                x

                      S1                   S2

                  ...
Finite-State Machines

          reset
set   1           0   reset
          set




                         c 2005–2008 ...
Finite-State Machines

                  reset
   set     1                 0    reset
                   set


          ...
Finite-State Machines
                                a               game A
                     40/0
                a  ...
FSMs to Specify Protocols




               c 2005–2008 Antonio Carzaniga
FSMs to Specify Protocols
States represent the state of a protocol




                                           c 2005–2...
FSMs to Specify Protocols
States represent the state of a protocol

Transitions are characterized by an event/action label...
FSMs to Specify Protocols
States represent the state of a protocol

Transitions are characterized by an event/action label...
Example
E.g., a subset of a server-side, SMTP-like protocol


                               30sec
                       ...
Back to Reliable Data Transfer
application


                Web               Web
              browser            server...
Back to Reliable Data Transfer
application


                Web                               Web
              browser  ...
Back to Reliable Data Transfer
application


                    Web                                Web
                  ...
Back to Reliable Data Transfer
application


                        Web                                Web
              ...
Back to Reliable Data Transfer
application


                        Web                                Web
              ...
Back to Reliable Data Transfer
application


                        Web                                Web
              ...
Reliable Data Transfer Model

sender            receiver




                         c 2005–2008 Antonio Carzaniga
Reliable Data Transfer Model

    sender             receiver




reliable-transfer
     protocol
    (sender)




       ...
Reliable Data Transfer Model

      sender             receiver


r_send()


  reliable-transfer
       protocol
      (se...
Reliable Data Transfer Model

       sender                    receiver


 r_send()


   reliable-transfer
        protoco...
Reliable Data Transfer Model

       sender                        receiver


 r_send()                                 r_...
Baseline Protocol
Reliable transport protocol that uses a reliable network
(obviously a contrived example)




sender

   ...
Baseline Protocol
Reliable transport protocol that uses a reliable network
(obviously a contrived example)




sender     ...
Baseline Protocol
Reliable transport protocol that uses a reliable network
(obviously a contrived example)




sender     ...
Noisy Channel




   c 2005–2008 Antonio Carzaniga
Noisy Channel
Reliable transport protocol over a network with bit errors
  ◮   every so often, a bit will be modified durin...
Noisy Channel
Reliable transport protocol over a network with bit errors
  ◮   every so often, a bit will be modified durin...
Noisy Channel
Reliable transport protocol over a network with bit errors
  ◮   every so often, a bit will be modified durin...
Noisy Channel
Reliable transport protocol over a network with bit errors
  ◮   every so often, a bit will be modified durin...
Noisy Channel
Reliable transport protocol over a network with bit errors
  ◮   every so often, a bit will be modified durin...
Error Detection




     c 2005–2008 Antonio Carzaniga
Error Detection
Key idea: sending redundant information
  ◮   e.g., the sender could repeat the message twice




        ...
Error Detection
Key idea: sending redundant information
  ◮   e.g., the sender could repeat the message twice
  ◮   error ...
Error Detection
Key idea: sending redundant information
  ◮   e.g., the sender could repeat the message twice
  ◮   error ...
Error Detection
Key idea: sending redundant information
  ◮   e.g., the sender could repeat the message twice
  ◮   error ...
Error Detection
Key idea: sending redundant information
  ◮   e.g., the sender could repeat the message twice
  ◮   error ...
Error Detection
Key idea: sending redundant information
  ◮   e.g., the sender could repeat the message twice
  ◮   error ...
Error Detection
Key idea: sending redundant information
  ◮   e.g., the sender could repeat the message twice
  ◮   error ...
Error Detection
Key idea: sending redundant information
  ◮   e.g., the sender could repeat the message twice
  ◮   error ...
Error Detection
Key idea: sending redundant information
  ◮   e.g., the sender could repeat the message twice
  ◮   error ...
Error Detection
Key idea: sending redundant information
  ◮   e.g., the sender could repeat the message twice
  ◮   error ...
Error Detection
Key idea: sending redundant information
  ◮   e.g., the sender could repeat the message twice
  ◮   error ...
Error Detection
Key idea: sending redundant information
  ◮   e.g., the sender could repeat the message twice
  ◮   error ...
Noisy Channel
Sender
 ◮   [data]∗ indicates a packet containing data plus an error-detection
     code (i.e., a checksum)
...
Noisy Channel
Sender
 ◮   [data]∗ indicates a packet containing data plus an error-detection
     code (i.e., a checksum)
...
Noisy Channel
Sender
  ◮   [data]∗ indicates a packet containing data plus an error-detection
      code (i.e., a checksum...
Noisy Channel




   c 2005–2008 Antonio Carzaniga
Noisy Channel
This protocol is “synchronous” or “stop-and-wait” for each packet
  ◮   i.e., the sender must receive a (pos...
Noisy Channel
This protocol is “synchronous” or “stop-and-wait” for each packet
  ◮   i.e., the sender must receive a (pos...
Noisy Channel
This protocol is “synchronous” or “stop-and-wait” for each packet
  ◮   i.e., the sender must receive a (pos...
Dealing With Bad ACKs/NACKs




                  c 2005–2008 Antonio Carzaniga
Dealing With Bad ACKs/NACKs
Negative acknowledgments for ACKs and NACKs
 1. sender says: “let’s go see Taxi Driver”
 2. re...
Dealing With Bad ACKs/NACKs
Negative acknowledgments for ACKs and NACKs
 1. sender says: “let’s go see Taxi Driver”
 2. re...
Dealing With Bad ACKs/NACKs
Negative acknowledgments for ACKs and NACKs
 1.   sender says: “let’s go see Taxi Driver”
 2. ...
Dealing With Bad ACKs/NACKs
Negative acknowledgments for ACKs and NACKs
 1.   sender says: “let’s go see Taxi Driver”
 2. ...
Dealing With Bad ACKs/NACKs
Negative acknowledgments for ACKs and NACKs
 1.   sender says: “let’s go see Taxi Driver”
 2. ...
Dealing With Bad ACKs/NACKs
Negative acknowledgments for ACKs and NACKs
 1.   sender says: “let’s go see Taxi Driver”
 2. ...
Dealing With Bad ACKs/NACKs
Negative acknowledgments for ACKs and NACKs
 1.   sender says: “let’s go see Taxi Driver”
 2. ...
Dealing With Bad ACKs/NACKs
Negative acknowledgments for ACKs and NACKs
 1.   sender says: “let’s go see Taxi Driver”
 2. ...
Dealing With Bad ACKs/NACKs
Negative acknowledgments for ACKs and NACKs
 1.   sender says: “let’s go see Taxi Driver”
 2. ...
Dealing With Duplicate Packets




                    c 2005–2008 Antonio Carzaniga
Dealing With Duplicate Packets
The sender adds a sequence number to each packet so that the
receiver can determine whether...
Dealing With Duplicate Packets
The sender adds a sequence number to each packet so that the
receiver can determine whether...
Dealing With Duplicate Packets
The sender adds a sequence number to each packet so that the
receiver can determine whether...
Dealing With Duplicate Packets
The sender adds a sequence number to each packet so that the
receiver can determine whether...
Dealing With Duplicate Packets
The sender adds a sequence number to each packet so that the
receiver can determine whether...
Dealing With Duplicate Packets
The sender adds a sequence number to each packet so that the
receiver can determine whether...
Dealing With Duplicate Packets
The sender adds a sequence number to each packet so that the
receiver can determine whether...
Dealing With Duplicate Packets
The sender adds a sequence number to each packet so that the
receiver can determine whether...
Using Sequence Numbers: Sender
                            r send(data)
                            data pkt = [0, data]∗
...
Using Sequence Numbers: Receiver
u recv(pkt)
                                 u recv(pkt)
and pkt is good
                ...
Better Use of ACKs
Do we really need both ACKs and NACKs?




                                         c 2005–2008 Antonio...
Better Use of ACKs
Do we really need both ACKs and NACKs?

Idea: now that we have sequence numbers, the receiver can
conve...
Better Use of ACKs
Do we really need both ACKs and NACKs?

Idea: now that we have sequence numbers, the receiver can
conve...
Better Use of ACKs
Do we really need both ACKs and NACKs?

Idea: now that we have sequence numbers, the receiver can
conve...
Better Use of ACKs
Do we really need both ACKs and NACKs?

Idea: now that we have sequence numbers, the receiver can
conve...
ACK-Only Protocol: Sender



S0




               c 2005–2008 Antonio Carzaniga
ACK-Only Protocol: Sender
 r send(data)
 data pkt = [0, data]∗
 u send(data pkt)

S0                 ACK0




            ...
ACK-Only Protocol: Sender
 r send(data)
 data pkt = [0, data]∗
 u send(data pkt)

S0                 ACK0



             ...
ACK-Only Protocol: Sender
  r send(data)
  data pkt = [0, data]∗
  u send(data pkt)

 S0                 ACK0



         ...
ACK-Only Protocol: Sender
                       r send(data)
                       data pkt = [0, data]∗
               ...
ACK-Only Protocol: Sender
                       r send(data)
                       data pkt = [0, data]∗
               ...
ACK-Only Protocol: Sender
                            r send(data)
                            data pkt = [0, data]∗
     ...
ACK-Only Protocol: Receiver

      R0




                 c 2005–2008 Antonio Carzaniga
ACK-Only Protocol: Receiver

      R0




           u recv(pkt)
           and pkt is good
           and seq num(pkt) is...
ACK-Only Protocol: Receiver

                        R0




u recv(pkt)                  u recv(pkt)
and pkt is good      ...
ACK-Only Protocol: Receiver

                               u recv(pkt)
                        R0     and pkt is corrupte...
ACK-Only Protocol: Receiver
u recv(pkt)
                                 u recv(pkt)
and pkt is good
                     ...
Summary of Principles and Techniques




                          c 2005–2008 Antonio Carzaniga
Summary of Principles and Techniques
Error detection codes (checksums) can be used to detect
transmission errors




     ...
Summary of Principles and Techniques
Error detection codes (checksums) can be used to detect
transmission errors

Retransm...
Summary of Principles and Techniques
Error detection codes (checksums) can be used to detect
transmission errors

Retransm...
Summary of Principles and Techniques
Error detection codes (checksums) can be used to detect
transmission errors

Retransm...
Summary of Principles and Techniques
Error detection codes (checksums) can be used to detect
transmission errors

Retransm...
Lossy And Noisy Channel




             c 2005–2008 Antonio Carzaniga
Lossy And Noisy Channel
Reliable transport protocol over a network that may
  ◮   introduce bit errors
  ◮   loose packets...
Lossy And Noisy Channel
Reliable transport protocol over a network that may
  ◮   introduce bit errors
  ◮   loose packets...
Lossy And Noisy Channel
Reliable transport protocol over a network that may
  ◮   introduce bit errors
  ◮   loose packets...
Lossy And Noisy Channel
Reliable transport protocol over a network that may
  ◮   introduce bit errors
  ◮   loose packets...
Sender Using Timeouts




S0




                c 2005–2008 Antonio Carzaniga
Sender Using Timeouts

r send(data)
data pkt = [0, data]∗
u send(data pkt)
start timer()
      S0                ACK0




...
Sender Using Timeouts
                        timeout
r send(data)            u send(data pkt)
data pkt = [0, data]∗   sta...
Sender Using Timeouts
                        timeout
r send(data)            u send(data pkt)
data pkt = [0, data]∗   sta...
Sender Using Timeouts
                        timeout
r send(data)            u send(data pkt)
data pkt = [0, data]∗   sta...
Sender Using Timeouts
                        timeout
r send(data)            u send(data pkt)
data pkt = [0, data]∗   sta...
Sender Using Timeouts
                        timeout
r send(data)            u send(data pkt)
data pkt = [0, data]∗   sta...
Sender Using Timeouts
                                               timeout
                       r send(data)          ...
Sender Using Timeouts
                                               timeout
                       r send(data)          ...
Part II

Efficient and Reliable Streams




                        c 2005–2008 Antonio Carzaniga
Quantifying Data Transfer
How do we measure the “speed” and “capacity” of a network
connection?




                      ...
Quantifying Data Transfer
How do we measure the “speed” and “capacity” of a network
connection?

Intuition
  ◮   water mov...
Quantifying Data Transfer
How do we measure the “speed” and “capacity” of a network
connection?

Intuition
  ◮   water mov...
Quantifying Data Transfer
How do we measure the “speed” and “capacity” of a network
connection?

Intuition
  ◮   water mov...
Latency and Throughput

connection




             c 2005–2008 Antonio Carzaniga
Latency and Throughput

                connection
 message
100 · · · 110




                             c 2005–2008 Ant...
Latency and Throughput

                 connection

100 · · · 110


            t0




                              c 20...
Latency and Throughput

     connection

          100 · · · 110


t0                    t1




                          ...
Latency and Throughput

     connection

                   100 · · · 110


t0                t1            t2




       ...
Latency and Throughput

     connection        n bits

                   100 · · · 110


t0                t1            ...
Latency and Throughput

          connection             n bits

                           100 · · · 110


 t0           ...
Latency and Throughput

             connection               n bits

                                100 · · · 110


    ...
Latency and Throughput

                connection               n bits

                                   100 · · · 110
...
Examples
How long does it take to tranfer a file between, say, Lugano and
St. Petersburg?




                             ...
Examples
How long does it take to tranfer a file between, say, Lugano and
St. Petersburg?

How big is this file? And how fas...
Examples
How long does it take to tranfer a file between, say, Lugano and
St. Petersburg?

How big is this file? And how fas...
Examples
How long does it take to tranfer a file between, say, Lugano and
St. Petersburg?

How big is this file? And how fas...
Examples
How about a big file? (E.g., a CD)




                                    c 2005–2008 Antonio Carzaniga
Examples
How about a big file? (E.g., a CD)

S   =   400Mb
L   =   500ms
T   =   1Mb /s
∆   =   ?




                     ...
Examples
How about a big file? (E.g., a CD)

S   =   400Mb
L   =   500ms
T   =   1Mb /s
∆   =   500ms + 400s = 400.5s = 6′ ...
Examples
How about a big file? (E.g., a CD)

S   =   400Mb
L   =   500ms
T   =   1Mb /s
∆   =   500ms + 400s = 400.5s = 6′ ...
Examples
How about a big file? (E.g., a CD)

S   =   400Mb
L   =   500ms
T   =   1Mb /s
∆   =   500ms + 400s = 400.5s = 6′ ...
Examples
How about a big file? (E.g., a CD)

S   =   400Mb
L   =   500ms
T   =   1Mb /s
∆   =   500ms + 400s = 400.5s = 6′ ...
Examples
How about flying to St. Petersburgh?




                                      c 2005–2008 Antonio Carzaniga
Examples
How about flying to St. Petersburgh?
  ◮   assuming you can carry more or less 100 DVDs in your backpack
  ◮   ass...
Examples
How about flying to St. Petersburgh?
    ◮   assuming you can carry more or less 100 DVDs in your backpack
    ◮  ...
Examples
How about flying to St. Petersburgh?
    ◮   assuming you can carry more or less 100 DVDs in your backpack
    ◮  ...
Examples
How about flying to St. Petersburgh?
    ◮   assuming you can carry more or less 100 DVDs in your backpack
    ◮  ...
Examples
How about flying to St. Petersburgh?
    ◮   assuming you can carry more or less 100 DVDs in your backpack
    ◮  ...
Examples
How about flying to St. Petersburgh?
    ◮   assuming you can carry more or less 100 DVDs in your backpack
    ◮  ...
Back to Reliable Data Tranfer




                  c 2005–2008 Antonio Carzaniga
Back to Reliable Data Tranfer
                        r send(data)           timeout
                        data pkt = [0...
Back to Reliable Data Tranfer
                        r send(data)           timeout
                        data pkt = [0...
Back to Reliable Data Tranfer
                        r send(data)           timeout
                        data pkt = [0...
Back to Reliable Data Tranfer
                        r send(data)           timeout
                        data pkt = [0...
Back to Reliable Data Tranfer
                        r send(data)           timeout
                        data pkt = [0...
Back to Reliable Data Tranfer
                        r send(data)           timeout
                        data pkt = [0...
Back to Reliable Data Tranfer
                        r send(data)           timeout
                        data pkt = [0...
Back to Reliable Data Tranfer
                        r send(data)           timeout
                        data pkt = [0...
Back to Reliable Data Tranfer
                        r send(data)           timeout
                        data pkt = [0...
Back to Reliable Data Tranfer
                        r send(data)           timeout
                        data pkt = [0...
Network Usage

                sender   receiver
r send(pkt1 )




                                    c 2005–2008 Antonio...
Network Usage

                   sender   receiver
r send(pkt1 )
      u send([pkt1 ,0])




                            ...
Network Usage

                   sender               receiver
r send(pkt1 )
      u send([pkt1 ,0])
                    ...
Network Usage

                   sender               receiver
r send(pkt1 )
      u send([pkt1 ,0])
                    ...
Network Usage

                   sender                 receiver
r send(pkt1 )
      u send([pkt1 ,0])
                  ...
Network Usage

                   sender                 receiver
r send(pkt1 )
      u send([pkt1 ,0])
                  ...
Network Usage

                   sender                 receiver
r send(pkt1 )
      u send([pkt1 ,0])
                  ...
Network Usage

                   sender                 receiver
r send(pkt1 )
      u send([pkt1 ,0])
                  ...
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
20080426 networking carzaniga_lecture01-02
Upcoming SlideShare
Loading in …5
×

20080426 networking carzaniga_lecture01-02

1,273 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

20080426 networking carzaniga_lecture01-02

  1. 1. Computer Networks: The Transport Layer Antonio Carzaniga Faculty of Informatics University of Lugano St. Petersburg, Russia April 26, 2008 c 2005–2008 Antonio Carzaniga
  2. 2. Outline Very quick intro to computer networking The transport layer ◮ reliability ◮ congestion control ◮ brief intro to TCP c 2005–2008 Antonio Carzaniga
  3. 3. Application web web browser server c 2005–2008 Antonio Carzaniga
  4. 4. Application web web browser server c 2005–2008 Antonio Carzaniga
  5. 5. Application GET /carzaniga/ HTTP/1.1 Host: www.inf.unisi.ch ... web web browser server c 2005–2008 Antonio Carzaniga
  6. 6. Application web web browser server HTTP/1.1 200 OK ... <html><head>. . . </head><body> ... c 2005–2008 Antonio Carzaniga
  7. 7. Application GET /carzaniga/anto.png HTTP/1.1 Host: www.inf.unisi.ch ... web web browser server c 2005–2008 Antonio Carzaniga
  8. 8. Application web web browser server HTTP/1.1 200 OK ... ... c 2005–2008 Antonio Carzaniga
  9. 9. Transport web web browser server c 2005–2008 Antonio Carzaniga
  10. 10. Transport web web browser server c 2005–2008 Antonio Carzaniga
  11. 11. Transport web web browser server c 2005–2008 Antonio Carzaniga
  12. 12. Network web web browser server c 2005–2008 Antonio Carzaniga
  13. 13. Network web web browser server c 2005–2008 Antonio Carzaniga
  14. 14. Network web web browser server c 2005–2008 Antonio Carzaniga
  15. 15. Network c 2005–2008 Antonio Carzaniga
  16. 16. Network c 2005–2008 Antonio Carzaniga
  17. 17. Network c 2005–2008 Antonio Carzaniga
  18. 18. Network c 2005–2008 Antonio Carzaniga
  19. 19. Network c 2005–2008 Antonio Carzaniga
  20. 20. Network c 2005–2008 Antonio Carzaniga
  21. 21. Network c 2005–2008 Antonio Carzaniga
  22. 22. Network Potentially multiple paths for the same source/destination c 2005–2008 Antonio Carzaniga
  23. 23. Network Potentially multiple paths for the same source/destination c 2005–2008 Antonio Carzaniga
  24. 24. Network Potentially multiple paths for the same source/destination c 2005–2008 Antonio Carzaniga
  25. 25. Network Potentially multiple paths for the same source/destination c 2005–2008 Antonio Carzaniga
  26. 26. Network Potentially multiple paths for the same source/destination c 2005–2008 Antonio Carzaniga
  27. 27. Network Potentially multiple paths for the same source/destination c 2005–2008 Antonio Carzaniga
  28. 28. Network Potentially multiple paths for the same source/destination c 2005–2008 Antonio Carzaniga
  29. 29. Network Potentially multiple paths for the same source/destination c 2005–2008 Antonio Carzaniga
  30. 30. Network Potentially multiple paths for the same source/destination Potentially asymmetric paths c 2005–2008 Antonio Carzaniga
  31. 31. Network Potentially multiple paths for the same source/destination Potentially asymmetric paths c 2005–2008 Antonio Carzaniga
  32. 32. Network Potentially multiple paths for the same source/destination Potentially asymmetric paths c 2005–2008 Antonio Carzaniga
  33. 33. Network Potentially multiple paths for the same source/destination Potentially asymmetric paths c 2005–2008 Antonio Carzaniga
  34. 34. Network Potentially multiple paths for the same source/destination Potentially asymmetric paths c 2005–2008 Antonio Carzaniga
  35. 35. Network Potentially multiple paths for the same source/destination Potentially asymmetric paths c 2005–2008 Antonio Carzaniga
  36. 36. A “Datagram” Network c 2005–2008 Antonio Carzaniga
  37. 37. A “Datagram” Network Packet-switched network c 2005–2008 Antonio Carzaniga
  38. 38. A “Datagram” Network Packet-switched network ◮ information is transmitted in discrete units called datagrams c 2005–2008 Antonio Carzaniga
  39. 39. A “Datagram” Network Packet-switched network ◮ information is transmitted in discrete units called datagrams Connectionless service c 2005–2008 Antonio Carzaniga
  40. 40. A “Datagram” Network Packet-switched network ◮ information is transmitted in discrete units called datagrams Connectionless service ◮ a datagram is a self-contained message ◮ treated independently by the network ◮ no connection setup/tear-down phase c 2005–2008 Antonio Carzaniga
  41. 41. A “Datagram” Network Packet-switched network ◮ information is transmitted in discrete units called datagrams Connectionless service ◮ a datagram is a self-contained message ◮ treated independently by the network ◮ no connection setup/tear-down phase “Best-effort” service c 2005–2008 Antonio Carzaniga
  42. 42. A “Datagram” Network Packet-switched network ◮ information is transmitted in discrete units called datagrams Connectionless service ◮ a datagram is a self-contained message ◮ treated independently by the network ◮ no connection setup/tear-down phase “Best-effort” service ◮ delivery guarantee: none c 2005–2008 Antonio Carzaniga
  43. 43. A “Datagram” Network Packet-switched network ◮ information is transmitted in discrete units called datagrams Connectionless service ◮ a datagram is a self-contained message ◮ treated independently by the network ◮ no connection setup/tear-down phase “Best-effort” service ◮ delivery guarantee: none ◮ maximum latency guarantee: none c 2005–2008 Antonio Carzaniga
  44. 44. A “Datagram” Network Packet-switched network ◮ information is transmitted in discrete units called datagrams Connectionless service ◮ a datagram is a self-contained message ◮ treated independently by the network ◮ no connection setup/tear-down phase “Best-effort” service ◮ delivery guarantee: none ◮ maximum latency guarantee: none ◮ bandwidth guarantee: none c 2005–2008 Antonio Carzaniga
  45. 45. A “Datagram” Network Packet-switched network ◮ information is transmitted in discrete units called datagrams Connectionless service ◮ a datagram is a self-contained message ◮ treated independently by the network ◮ no connection setup/tear-down phase “Best-effort” service ◮ delivery guarantee: none ◮ maximum latency guarantee: none ◮ bandwidth guarantee: none ◮ in-order delivery guarantee: none c 2005–2008 Antonio Carzaniga
  46. 46. A “Datagram” Network Packet-switched network ◮ information is transmitted in discrete units called datagrams Connectionless service ◮ a datagram is a self-contained message ◮ treated independently by the network ◮ no connection setup/tear-down phase “Best-effort” service ◮ delivery guarantee: none ◮ maximum latency guarantee: none ◮ bandwidth guarantee: none ◮ in-order delivery guarantee: none ◮ congestion indication: none c 2005–2008 Antonio Carzaniga
  47. 47. Transport-Layer Value-Added Service c 2005–2008 Antonio Carzaniga
  48. 48. Transport-Layer Value-Added Service Transport-layer multiplexing/demultiplexing ◮ i.e., connecting applications as opposed to hosts c 2005–2008 Antonio Carzaniga
  49. 49. Transport-Layer Value-Added Service Transport-layer multiplexing/demultiplexing ◮ i.e., connecting applications as opposed to hosts Reliable data transfer ◮ i.e., integrity and possibly ordered delivery c 2005–2008 Antonio Carzaniga
  50. 50. Transport-Layer Value-Added Service Transport-layer multiplexing/demultiplexing ◮ i.e., connecting applications as opposed to hosts Reliable data transfer ◮ i.e., integrity and possibly ordered delivery Connections ◮ i.e., streams ◮ can be seen as the same as ordered dalivery c 2005–2008 Antonio Carzaniga
  51. 51. Transport-Layer Value-Added Service Transport-layer multiplexing/demultiplexing ◮ i.e., connecting applications as opposed to hosts Reliable data transfer ◮ i.e., integrity and possibly ordered delivery Connections ◮ i.e., streams ◮ can be seen as the same as ordered dalivery Congestion control ◮ i.e., end-to-end traffic (admission) control so as to avoid destructive congestions within the network c 2005–2008 Antonio Carzaniga
  52. 52. Transport web web browser server c 2005–2008 Antonio Carzaniga
  53. 53. Transport web web browser server c 2005–2008 Antonio Carzaniga
  54. 54. Transport web web browser server c 2005–2008 Antonio Carzaniga
  55. 55. Transport web web browser server unreliable, datagram =⇒ reliable “stream” c 2005–2008 Antonio Carzaniga
  56. 56. Part I Reliable Streams on Unreliable Networks c 2005–2008 Antonio Carzaniga
  57. 57. Finite-State Machines c 2005–2008 Antonio Carzaniga
  58. 58. Finite-State Machines A finite-state machine (FSM) is a mathematical abstraction ◮ a.k.a., finite-state automaton (FSA), deterministic finite-state automaton (DFA), non-deterministic finite-state automaton (NFA) c 2005–2008 Antonio Carzaniga
  59. 59. Finite-State Machines A finite-state machine (FSM) is a mathematical abstraction ◮ a.k.a., finite-state automaton (FSA), deterministic finite-state automaton (DFA), non-deterministic finite-state automaton (NFA) Very useful to specify and implement network protocols c 2005–2008 Antonio Carzaniga
  60. 60. Finite-State Machines A finite-state machine (FSM) is a mathematical abstraction ◮ a.k.a., finite-state automaton (FSA), deterministic finite-state automaton (DFA), non-deterministic finite-state automaton (NFA) Very useful to specify and implement network protocols Ubiquitous in computer science ◮ theory of formal languages ◮ compiler design ◮ theory of computation ◮ text processing ◮ behavior specification ◮ ... c 2005–2008 Antonio Carzaniga
  61. 61. Finite-State Machines x S1 S2 x c 2005–2008 Antonio Carzaniga
  62. 62. Finite-State Machines x S1 S2 x States are represented as nodes in a graph c 2005–2008 Antonio Carzaniga
  63. 63. Finite-State Machines x S1 S2 x States are represented as nodes in a graph Transitions are represented as directed edges in the graph c 2005–2008 Antonio Carzaniga
  64. 64. Finite-State Machines x S1 S2 x States are represented as nodes in a graph Transitions are represented as directed edges in the graph ◮ an edge labeled x going from state S1 to state S2 says that when the machine is in state S1 and event x occurs, the machine switches to state S2 c 2005–2008 Antonio Carzaniga
  65. 65. Finite-State Machines x S1 S2 x States are represented as nodes in a graph Transitions are represented as directed edges in the graph ◮ an edge labeled x going from state S1 to state S2 says that when the machine is in state S1 and event x occurs, the machine switches to state S2 button-pushed On Off button-pushed c 2005–2008 Antonio Carzaniga
  66. 66. Finite-State Machines reset set 1 0 reset set c 2005–2008 Antonio Carzaniga
  67. 67. Finite-State Machines reset set 1 0 reset set try-unlock button-1 button-2 1s timeout locked unlocked 30s timeout c 2005–2008 Antonio Carzaniga
  68. 68. Finite-State Machines a game A 40/0 a b a 30/0 40/15 a a a b a b adv. A 15/0 30/15 40/30 b a b a b a b a 0/0 15/15 30/30 deuce b a b a b a b 0/15 15/30 30/40 a b a b a adv. B b b 0/30 15/40 b a b 0/40 game B b c 2005–2008 Antonio Carzaniga
  69. 69. FSMs to Specify Protocols c 2005–2008 Antonio Carzaniga
  70. 70. FSMs to Specify Protocols States represent the state of a protocol c 2005–2008 Antonio Carzaniga
  71. 71. FSMs to Specify Protocols States represent the state of a protocol Transitions are characterized by an event/action label ◮ event: typically consists of an input message or a timeout ◮ action: typically consists of an output message c 2005–2008 Antonio Carzaniga
  72. 72. FSMs to Specify Protocols States represent the state of a protocol Transitions are characterized by an event/action label ◮ event: typically consists of an input message or a timeout ◮ action: typically consists of an output message E.g., here’s a specification of a “simple conversation protocol” “Hello!” input “Yo” output S C “bla” “aha” “Bye.” “Okay. Bye.” 30s “Gotta go. Bye.” c 2005–2008 Antonio Carzaniga
  73. 73. Example E.g., a subset of a server-side, SMTP-like protocol 30sec close R 60s close “RCPT TO” accept “MAIL FROM” “DATA” “250 Ok” “220 Ok” “250 Ok” “354 end with .” S A D M line 60sec “MAIL FROM” “RCPT TO” close “250 Ok” “250 Ok” “.” “250 accepted” “QUIT” T “221 bye”,close 30sec close c 2005–2008 Antonio Carzaniga
  74. 74. Back to Reliable Data Transfer application Web Web browser server c 2005–2008 Antonio Carzaniga
  75. 75. Back to Reliable Data Transfer application Web Web browser server network best-effort (i.e., unreliable) network c 2005–2008 Antonio Carzaniga
  76. 76. Back to Reliable Data Transfer application Web Web browser server transport reliable-transfer reliable-transfer protocol protocol network best-effort (i.e., unreliable) network c 2005–2008 Antonio Carzaniga
  77. 77. Back to Reliable Data Transfer application Web Web browser server r_send() r_recv() transport reliable-transfer reliable-transfer protocol protocol network best-effort (i.e., unreliable) network c 2005–2008 Antonio Carzaniga
  78. 78. Back to Reliable Data Transfer application Web Web browser server r_send() r_recv() transport reliable-transfer reliable-transfer protocol protocol u_send() u_recv() network best-effort (i.e., unreliable) network c 2005–2008 Antonio Carzaniga
  79. 79. Back to Reliable Data Transfer application Web Web browser server r_send() r_recv() r_send() r_recv() transport reliable-transfer reliable-transfer protocol protocol u_send() u_recv() u_send() u_recv() network best-effort (i.e., unreliable) network c 2005–2008 Antonio Carzaniga
  80. 80. Reliable Data Transfer Model sender receiver c 2005–2008 Antonio Carzaniga
  81. 81. Reliable Data Transfer Model sender receiver reliable-transfer protocol (sender) c 2005–2008 Antonio Carzaniga
  82. 82. Reliable Data Transfer Model sender receiver r_send() reliable-transfer protocol (sender) c 2005–2008 Antonio Carzaniga
  83. 83. Reliable Data Transfer Model sender receiver r_send() reliable-transfer protocol (sender) u_send() u_recv() network c 2005–2008 Antonio Carzaniga
  84. 84. Reliable Data Transfer Model sender receiver r_send() r_recv() reliable-transfer reliable-transfer protocol protocol (sender) (receiver) u_send() u_recv() u_send() u_recv() network c 2005–2008 Antonio Carzaniga
  85. 85. Baseline Protocol Reliable transport protocol that uses a reliable network (obviously a contrived example) sender r send(data) S u send(data) c 2005–2008 Antonio Carzaniga
  86. 86. Baseline Protocol Reliable transport protocol that uses a reliable network (obviously a contrived example) sender receiver r send(data) u recv(data) S R u send(data) r recv(data) c 2005–2008 Antonio Carzaniga
  87. 87. Baseline Protocol Reliable transport protocol that uses a reliable network (obviously a contrived example) sender receiver r send(data) u recv(data) S R u send(data) r recv(data) c 2005–2008 Antonio Carzaniga
  88. 88. Noisy Channel c 2005–2008 Antonio Carzaniga
  89. 89. Noisy Channel Reliable transport protocol over a network with bit errors ◮ every so often, a bit will be modified during transmission ◮ that is, a bit will be “flipped” ◮ however, no packets will be lost c 2005–2008 Antonio Carzaniga
  90. 90. Noisy Channel Reliable transport protocol over a network with bit errors ◮ every so often, a bit will be modified during transmission ◮ that is, a bit will be “flipped” ◮ however, no packets will be lost How do people deal with such situations? (Think of a phone call over a noisy line) c 2005–2008 Antonio Carzaniga
  91. 91. Noisy Channel Reliable transport protocol over a network with bit errors ◮ every so often, a bit will be modified during transmission ◮ that is, a bit will be “flipped” ◮ however, no packets will be lost How do people deal with such situations? (Think of a phone call over a noisy line) ◮ error detection: the receiver must be able to know when a received packet is corrupted (i.e., when it contains flipped bits) c 2005–2008 Antonio Carzaniga
  92. 92. Noisy Channel Reliable transport protocol over a network with bit errors ◮ every so often, a bit will be modified during transmission ◮ that is, a bit will be “flipped” ◮ however, no packets will be lost How do people deal with such situations? (Think of a phone call over a noisy line) ◮ error detection: the receiver must be able to know when a received packet is corrupted (i.e., when it contains flipped bits) ◮ receiver feedback: the receiver must be able to alert the sender that a corrupted packet was received c 2005–2008 Antonio Carzaniga
  93. 93. Noisy Channel Reliable transport protocol over a network with bit errors ◮ every so often, a bit will be modified during transmission ◮ that is, a bit will be “flipped” ◮ however, no packets will be lost How do people deal with such situations? (Think of a phone call over a noisy line) ◮ error detection: the receiver must be able to know when a received packet is corrupted (i.e., when it contains flipped bits) ◮ receiver feedback: the receiver must be able to alert the sender that a corrupted packet was received ◮ retransmission: the sender retransmits corrupted packets c 2005–2008 Antonio Carzaniga
  94. 94. Error Detection c 2005–2008 Antonio Carzaniga
  95. 95. Error Detection Key idea: sending redundant information ◮ e.g., the sender could repeat the message twice c 2005–2008 Antonio Carzaniga
  96. 96. Error Detection Key idea: sending redundant information ◮ e.g., the sender could repeat the message twice ◮ error iff the receiver hears two different messages c 2005–2008 Antonio Carzaniga
  97. 97. Error Detection Key idea: sending redundant information ◮ e.g., the sender could repeat the message twice ◮ error iff the receiver hears two different messages ◮ not very efficient: uses twice the number of bits c 2005–2008 Antonio Carzaniga
  98. 98. Error Detection Key idea: sending redundant information ◮ e.g., the sender could repeat the message twice ◮ error iff the receiver hears two different messages ◮ not very efficient: uses twice the number of bits Error-detection codes c 2005–2008 Antonio Carzaniga
  99. 99. Error Detection Key idea: sending redundant information ◮ e.g., the sender could repeat the message twice ◮ error iff the receiver hears two different messages ◮ not very efficient: uses twice the number of bits Error-detection codes ◮ e.g., the parity bit c 2005–2008 Antonio Carzaniga
  100. 100. Error Detection Key idea: sending redundant information ◮ e.g., the sender could repeat the message twice ◮ error iff the receiver hears two different messages ◮ not very efficient: uses twice the number of bits Error-detection codes ◮ e.g., the parity bit ◮ sender adds one bit that is the xor of all the bits in the message c 2005–2008 Antonio Carzaniga
  101. 101. Error Detection Key idea: sending redundant information ◮ e.g., the sender could repeat the message twice ◮ error iff the receiver hears two different messages ◮ not very efficient: uses twice the number of bits Error-detection codes ◮ e.g., the parity bit ◮ sender adds one bit that is the xor of all the bits in the message ◮ receiver computes the xor of all the bits and concludes that there was an error if the result is not 0 (i.e., if it is 1) c 2005–2008 Antonio Carzaniga
  102. 102. Error Detection Key idea: sending redundant information ◮ e.g., the sender could repeat the message twice ◮ error iff the receiver hears two different messages ◮ not very efficient: uses twice the number of bits Error-detection codes ◮ e.g., the parity bit ◮ sender adds one bit that is the xor of all the bits in the message ◮ receiver computes the xor of all the bits and concludes that there was an error if the result is not 0 (i.e., if it is 1) Sender: message is 1001011011101000 c 2005–2008 Antonio Carzaniga
  103. 103. Error Detection Key idea: sending redundant information ◮ e.g., the sender could repeat the message twice ◮ error iff the receiver hears two different messages ◮ not very efficient: uses twice the number of bits Error-detection codes ◮ e.g., the parity bit ◮ sender adds one bit that is the xor of all the bits in the message ◮ receiver computes the xor of all the bits and concludes that there was an error if the result is not 0 (i.e., if it is 1) Sender: message is 1001011011101000 ⇒ send 10010110111010000 c 2005–2008 Antonio Carzaniga
  104. 104. Error Detection Key idea: sending redundant information ◮ e.g., the sender could repeat the message twice ◮ error iff the receiver hears two different messages ◮ not very efficient: uses twice the number of bits Error-detection codes ◮ e.g., the parity bit ◮ sender adds one bit that is the xor of all the bits in the message ◮ receiver computes the xor of all the bits and concludes that there was an error if the result is not 0 (i.e., if it is 1) Sender: message is 1001011011101000 ⇒ send 10010110111010000 c 2005–2008 Antonio Carzaniga
  105. 105. Error Detection Key idea: sending redundant information ◮ e.g., the sender could repeat the message twice ◮ error iff the receiver hears two different messages ◮ not very efficient: uses twice the number of bits Error-detection codes ◮ e.g., the parity bit ◮ sender adds one bit that is the xor of all the bits in the message ◮ receiver computes the xor of all the bits and concludes that there was an error if the result is not 0 (i.e., if it is 1) Sender: message is 1001011011101000 ⇒ send 10010110111010000 Receiver: receives 10010110101010000 c 2005–2008 Antonio Carzaniga
  106. 106. Error Detection Key idea: sending redundant information ◮ e.g., the sender could repeat the message twice ◮ error iff the receiver hears two different messages ◮ not very efficient: uses twice the number of bits Error-detection codes ◮ e.g., the parity bit ◮ sender adds one bit that is the xor of all the bits in the message ◮ receiver computes the xor of all the bits and concludes that there was an error if the result is not 0 (i.e., if it is 1) Sender: message is 1001011011101000 ⇒ send 10010110111010000 Receiver: receives 10010110101010000 ⇒ error! c 2005–2008 Antonio Carzaniga
  107. 107. Noisy Channel Sender ◮ [data]∗ indicates a packet containing data plus an error-detection code (i.e., a checksum) c 2005–2008 Antonio Carzaniga
  108. 108. Noisy Channel Sender ◮ [data]∗ indicates a packet containing data plus an error-detection code (i.e., a checksum) r send(data) data pkt = [data]∗ u send(data pkt) u recv(pkt) S ACK and pkt is NACK u send(data pkt) u recv(pkt) and pkt is ACK c 2005–2008 Antonio Carzaniga
  109. 109. Noisy Channel Sender ◮ [data]∗ indicates a packet containing data plus an error-detection code (i.e., a checksum) r send(data) data pkt = [data]∗ u send(data pkt) u recv(pkt) S ACK and pkt is NACK u send(data pkt) u recv(pkt) and pkt is ACK Receiver u recv(pkt) u recv(pkt) and pkt is good R and pkt is corrupted u send(ACK) u send(NACK) r recv(pkt) c 2005–2008 Antonio Carzaniga
  110. 110. Noisy Channel c 2005–2008 Antonio Carzaniga
  111. 111. Noisy Channel This protocol is “synchronous” or “stop-and-wait” for each packet ◮ i.e., the sender must receive a (positive) acknowledgment before it can take more data from the application layer c 2005–2008 Antonio Carzaniga
  112. 112. Noisy Channel This protocol is “synchronous” or “stop-and-wait” for each packet ◮ i.e., the sender must receive a (positive) acknowledgment before it can take more data from the application layer Does the protocol really work? c 2005–2008 Antonio Carzaniga
  113. 113. Noisy Channel This protocol is “synchronous” or “stop-and-wait” for each packet ◮ i.e., the sender must receive a (positive) acknowledgment before it can take more data from the application layer Does the protocol really work? What happens if an error occurs within an ACK/NACK packet? c 2005–2008 Antonio Carzaniga
  114. 114. Dealing With Bad ACKs/NACKs c 2005–2008 Antonio Carzaniga
  115. 115. Dealing With Bad ACKs/NACKs Negative acknowledgments for ACKs and NACKs 1. sender says: “let’s go see Taxi Driver” 2. receiver hears: “let’s . . . Taxi . . . ” c 2005–2008 Antonio Carzaniga
  116. 116. Dealing With Bad ACKs/NACKs Negative acknowledgments for ACKs and NACKs 1. sender says: “let’s go see Taxi Driver” 2. receiver hears: “let’s . . . Taxi . . . ” 3. receiver says: “Repeat message!” c 2005–2008 Antonio Carzaniga
  117. 117. Dealing With Bad ACKs/NACKs Negative acknowledgments for ACKs and NACKs 1. sender says: “let’s go see Taxi Driver” 2. receiver hears: “let’s . . . Taxi . . . ” 3. receiver says: “Repeat message!” 4. sender hears: “. . . noise . . . ” c 2005–2008 Antonio Carzaniga
  118. 118. Dealing With Bad ACKs/NACKs Negative acknowledgments for ACKs and NACKs 1. sender says: “let’s go see Taxi Driver” 2. receiver hears: “let’s . . . Taxi . . . ” 3. receiver says: “Repeat message!” 4. sender hears: “. . . noise . . . ” 5. sender says: “Repeat your ACK please!” 6. ... c 2005–2008 Antonio Carzaniga
  119. 119. Dealing With Bad ACKs/NACKs Negative acknowledgments for ACKs and NACKs 1. sender says: “let’s go see Taxi Driver” 2. receiver hears: “let’s . . . Taxi . . . ” 3. receiver says: “Repeat message!” 4. sender hears: “. . . noise . . . ” 5. sender says: “Repeat your ACK please!” 6. ... Not Good: this protocol doesn’t seem to end c 2005–2008 Antonio Carzaniga
  120. 120. Dealing With Bad ACKs/NACKs Negative acknowledgments for ACKs and NACKs 1. sender says: “let’s go see Taxi Driver” 2. receiver hears: “let’s . . . Taxi . . . ” 3. receiver says: “Repeat message!” 4. sender hears: “. . . noise . . . ” 5. sender says: “Repeat your ACK please!” 6. ... Not Good: this protocol doesn’t seem to end Make ACK/NACK packets so redundant that the sender can always figure out what the message is, even if a few bits are corrupted c 2005–2008 Antonio Carzaniga
  121. 121. Dealing With Bad ACKs/NACKs Negative acknowledgments for ACKs and NACKs 1. sender says: “let’s go see Taxi Driver” 2. receiver hears: “let’s . . . Taxi . . . ” 3. receiver says: “Repeat message!” 4. sender hears: “. . . noise . . . ” 5. sender says: “Repeat your ACK please!” 6. ... Not Good: this protocol doesn’t seem to end Make ACK/NACK packets so redundant that the sender can always figure out what the message is, even if a few bits are corrupted ◮ good enough for channels that do not loose messages c 2005–2008 Antonio Carzaniga
  122. 122. Dealing With Bad ACKs/NACKs Negative acknowledgments for ACKs and NACKs 1. sender says: “let’s go see Taxi Driver” 2. receiver hears: “let’s . . . Taxi . . . ” 3. receiver says: “Repeat message!” 4. sender hears: “. . . noise . . . ” 5. sender says: “Repeat your ACK please!” 6. ... Not Good: this protocol doesn’t seem to end Make ACK/NACK packets so redundant that the sender can always figure out what the message is, even if a few bits are corrupted ◮ good enough for channels that do not loose messages Assume a NACK and simply retransmit the packet c 2005–2008 Antonio Carzaniga
  123. 123. Dealing With Bad ACKs/NACKs Negative acknowledgments for ACKs and NACKs 1. sender says: “let’s go see Taxi Driver” 2. receiver hears: “let’s . . . Taxi . . . ” 3. receiver says: “Repeat message!” 4. sender hears: “. . . noise . . . ” 5. sender says: “Repeat your ACK please!” 6. ... Not Good: this protocol doesn’t seem to end Make ACK/NACK packets so redundant that the sender can always figure out what the message is, even if a few bits are corrupted ◮ good enough for channels that do not loose messages Assume a NACK and simply retransmit the packet ◮ good idea, but it introduces duplicate packets (why?) c 2005–2008 Antonio Carzaniga
  124. 124. Dealing With Duplicate Packets c 2005–2008 Antonio Carzaniga
  125. 125. Dealing With Duplicate Packets The sender adds a sequence number to each packet so that the receiver can determine whether a packet is a retransmission 1. sender says: “7: let’s go see Taxi Driver” c 2005–2008 Antonio Carzaniga
  126. 126. Dealing With Duplicate Packets The sender adds a sequence number to each packet so that the receiver can determine whether a packet is a retransmission 1. sender says: “7: let’s go see Taxi Driver” 2. receiver hears: “7: let’s go see Taxi Driver” 3. receiver passes “let’s go see Taxi Driver” to application layer 4. receiver says: “Got it!” (i.e., ACK) c 2005–2008 Antonio Carzaniga
  127. 127. Dealing With Duplicate Packets The sender adds a sequence number to each packet so that the receiver can determine whether a packet is a retransmission 1. sender says: “7: let’s go see Taxi Driver” 2. receiver hears: “7: let’s go see Taxi Driver” 3. receiver passes “let’s go see Taxi Driver” to application layer 4. receiver says: “Got it!” (i.e., ACK) 5. sender hears: “. . . noise . . . ” c 2005–2008 Antonio Carzaniga
  128. 128. Dealing With Duplicate Packets The sender adds a sequence number to each packet so that the receiver can determine whether a packet is a retransmission 1. sender says: “7: let’s go see Taxi Driver” 2. receiver hears: “7: let’s go see Taxi Driver” 3. receiver passes “let’s go see Taxi Driver” to application layer 4. receiver says: “Got it!” (i.e., ACK) 5. sender hears: “. . . noise . . . ” 6. sender (assuming a NACK) says: “7: let’s go see Taxi Driver” c 2005–2008 Antonio Carzaniga
  129. 129. Dealing With Duplicate Packets The sender adds a sequence number to each packet so that the receiver can determine whether a packet is a retransmission 1. sender says: “7: let’s go see Taxi Driver” 2. receiver hears: “7: let’s go see Taxi Driver” 3. receiver passes “let’s go see Taxi Driver” to application layer 4. receiver says: “Got it!” (i.e., ACK) 5. sender hears: “. . . noise . . . ” 6. sender (assuming a NACK) says: “7: let’s go see Taxi Driver” 7. receiver hears: “7: let’s go see Taxi Driver” 8. receiver ignores the packet c 2005–2008 Antonio Carzaniga
  130. 130. Dealing With Duplicate Packets The sender adds a sequence number to each packet so that the receiver can determine whether a packet is a retransmission 1. sender says: “7: let’s go see Taxi Driver” 2. receiver hears: “7: let’s go see Taxi Driver” 3. receiver passes “let’s go see Taxi Driver” to application layer 4. receiver says: “Got it!” (i.e., ACK) 5. sender hears: “. . . noise . . . ” 6. sender (assuming a NACK) says: “7: let’s go see Taxi Driver” 7. receiver hears: “7: let’s go see Taxi Driver” 8. receiver ignores the packet How many bits do we need for the sequence number? c 2005–2008 Antonio Carzaniga
  131. 131. Dealing With Duplicate Packets The sender adds a sequence number to each packet so that the receiver can determine whether a packet is a retransmission 1. sender says: “7: let’s go see Taxi Driver” 2. receiver hears: “7: let’s go see Taxi Driver” 3. receiver passes “let’s go see Taxi Driver” to application layer 4. receiver says: “Got it!” (i.e., ACK) 5. sender hears: “. . . noise . . . ” 6. sender (assuming a NACK) says: “7: let’s go see Taxi Driver” 7. receiver hears: “7: let’s go see Taxi Driver” 8. receiver ignores the packet How many bits do we need for the sequence number? ◮ this is a “stop-and-wait” protocol for each packet, so the receiver needs to distinguish between (1) the next packet and (2) the retransmission of the current packet c 2005–2008 Antonio Carzaniga
  132. 132. Dealing With Duplicate Packets The sender adds a sequence number to each packet so that the receiver can determine whether a packet is a retransmission 1. sender says: “7: let’s go see Taxi Driver” 2. receiver hears: “7: let’s go see Taxi Driver” 3. receiver passes “let’s go see Taxi Driver” to application layer 4. receiver says: “Got it!” (i.e., ACK) 5. sender hears: “. . . noise . . . ” 6. sender (assuming a NACK) says: “7: let’s go see Taxi Driver” 7. receiver hears: “7: let’s go see Taxi Driver” 8. receiver ignores the packet How many bits do we need for the sequence number? ◮ this is a “stop-and-wait” protocol for each packet, so the receiver needs to distinguish between (1) the next packet and (2) the retransmission of the current packet ◮ so, one bit is sufficient c 2005–2008 Antonio Carzaniga
  133. 133. Using Sequence Numbers: Sender r send(data) data pkt = [0, data]∗ u send(data pkt) u recv(pkt) and (pkt is NACK S0 ACK0 or pkt is corrupted) u send(data pkt) u recv(pkt) and pkt is good and pkt is ACK u recv(pkt) and pkt is good and pkt is ACK u recv(pkt) and (pkt is NACK or pkt is corrupted) ACK1 S1 u send(data pkt) r send(data) data pkt = [1, data]∗ u send(data pkt) c 2005–2008 Antonio Carzaniga
  134. 134. Using Sequence Numbers: Receiver u recv(pkt) u recv(pkt) and pkt is good R0 and pkt is corrupted and seq num(pkt) is 1 u send([NACK]∗ ) u send([ACK]∗ ) u recv(pkt) u recv(pkt) and pkt is good and pkt is good and seq num(pkt) is 1 and seq num(pkt) is 0 u send([ACK]∗ ) u send([ACK]∗ ) r recv(pkt) r recv(pkt) u recv(pkt) u recv(pkt) and pkt is good R1 and pkt is corrupted and seq num(pkt) is 0 u send([NACK]∗ ) u send([ACK]∗ ) c 2005–2008 Antonio Carzaniga
  135. 135. Better Use of ACKs Do we really need both ACKs and NACKs? c 2005–2008 Antonio Carzaniga
  136. 136. Better Use of ACKs Do we really need both ACKs and NACKs? Idea: now that we have sequence numbers, the receiver can convey the semantics of a NACK by sending an ACK for the last good packet it received c 2005–2008 Antonio Carzaniga
  137. 137. Better Use of ACKs Do we really need both ACKs and NACKs? Idea: now that we have sequence numbers, the receiver can convey the semantics of a NACK by sending an ACK for the last good packet it received 1. sender says: “7: let’s go see Taxi Driver” 2. receiver hears: “7: let’s go see Taxi Driver” 3. receiver says: “Got it!” 4. sender hears: “Got it!” 5. sender says: “8: let’s meet at 8:00PM” 6. receiver hears: “. . . noise . . . ” c 2005–2008 Antonio Carzaniga
  138. 138. Better Use of ACKs Do we really need both ACKs and NACKs? Idea: now that we have sequence numbers, the receiver can convey the semantics of a NACK by sending an ACK for the last good packet it received 1. sender says: “7: let’s go see Taxi Driver” 2. receiver hears: “7: let’s go see Taxi Driver” 3. receiver says: “Got it!” 4. sender hears: “Got it!” 5. sender says: “8: let’s meet at 8:00PM” 6. receiver hears: “. . . noise . . . ” 7. receiver now says: “Got 7” (instead of saying “Please, resend”) 8. sender hears: “Got 7” c 2005–2008 Antonio Carzaniga
  139. 139. Better Use of ACKs Do we really need both ACKs and NACKs? Idea: now that we have sequence numbers, the receiver can convey the semantics of a NACK by sending an ACK for the last good packet it received 1. sender says: “7: let’s go see Taxi Driver” 2. receiver hears: “7: let’s go see Taxi Driver” 3. receiver says: “Got it!” 4. sender hears: “Got it!” 5. sender says: “8: let’s meet at 8:00PM” 6. receiver hears: “. . . noise . . . ” 7. receiver now says: “Got 7” (instead of saying “Please, resend”) 8. sender hears: “Got 7” 9. sender knows that the current message is 8, and therefore repeats: “8: let’s meet at 8:00PM” c 2005–2008 Antonio Carzaniga
  140. 140. ACK-Only Protocol: Sender S0 c 2005–2008 Antonio Carzaniga
  141. 141. ACK-Only Protocol: Sender r send(data) data pkt = [0, data]∗ u send(data pkt) S0 ACK0 c 2005–2008 Antonio Carzaniga
  142. 142. ACK-Only Protocol: Sender r send(data) data pkt = [0, data]∗ u send(data pkt) S0 ACK0 u recv(pkt) and pkt is good and pkt = (ACK, 0) S1 c 2005–2008 Antonio Carzaniga
  143. 143. ACK-Only Protocol: Sender r send(data) data pkt = [0, data]∗ u send(data pkt) S0 ACK0 u recv(pkt) and pkt is good and pkt = (ACK, 0) ACK1 S1 r send(data) data pkt = [1, data]∗ u send(data pkt) c 2005–2008 Antonio Carzaniga
  144. 144. ACK-Only Protocol: Sender r send(data) data pkt = [0, data]∗ u send(data pkt) S0 ACK0 u recv(pkt) and pkt is good and pkt = (ACK, 1) u recv(pkt) and pkt is good and pkt = (ACK, 0) ACK1 S1 r send(data) data pkt = [1, data]∗ u send(data pkt) c 2005–2008 Antonio Carzaniga
  145. 145. ACK-Only Protocol: Sender r send(data) data pkt = [0, data]∗ u send(data pkt) u recv(pkt) and (pkt = (ACK, 1) S0 ACK0 or pkt is corrupted) u send(data pkt) u recv(pkt) and pkt is good and pkt = (ACK, 1) u recv(pkt) and pkt is good and pkt = (ACK, 0) ACK1 S1 r send(data) data pkt = [1, data]∗ u send(data pkt) c 2005–2008 Antonio Carzaniga
  146. 146. ACK-Only Protocol: Sender r send(data) data pkt = [0, data]∗ u send(data pkt) u recv(pkt) and (pkt = (ACK, 1) S0 ACK0 or pkt is corrupted) u send(data pkt) u recv(pkt) and pkt is good and pkt = (ACK, 1) u recv(pkt) and pkt is good and pkt = (ACK, 0) u recv(pkt) and (pkt = (ACK, 0) or pkt is corrupted) ACK1 S1 u send(data pkt) r send(data) data pkt = [1, data]∗ u send(data pkt) c 2005–2008 Antonio Carzaniga
  147. 147. ACK-Only Protocol: Receiver R0 c 2005–2008 Antonio Carzaniga
  148. 148. ACK-Only Protocol: Receiver R0 u recv(pkt) and pkt is good and seq num(pkt) is 0 u send([ACK,0]∗) r recv(pkt) R1 c 2005–2008 Antonio Carzaniga
  149. 149. ACK-Only Protocol: Receiver R0 u recv(pkt) u recv(pkt) and pkt is good and pkt is good and seq num(pkt) is 1 and seq num(pkt) is 0 u send([ACK,1]∗) u send([ACK,0]∗) r recv(pkt) r recv(pkt) R1 c 2005–2008 Antonio Carzaniga
  150. 150. ACK-Only Protocol: Receiver u recv(pkt) R0 and pkt is corrupted u send([ACK,1]∗) u recv(pkt) u recv(pkt) and pkt is good and pkt is good and seq num(pkt) is 1 and seq num(pkt) is 0 u send([ACK,1]∗) u send([ACK,0]∗) r recv(pkt) r recv(pkt) u recv(pkt) R1 and pkt is corrupted u send([ACK,0]∗) c 2005–2008 Antonio Carzaniga
  151. 151. ACK-Only Protocol: Receiver u recv(pkt) u recv(pkt) and pkt is good R0 and pkt is corrupted and seq num(pkt) is 1 u send([ACK,1]∗) u send([ACK,1]∗) u recv(pkt) u recv(pkt) and pkt is good and pkt is good and seq num(pkt) is 1 and seq num(pkt) is 0 u send([ACK,1]∗) u send([ACK,0]∗) r recv(pkt) r recv(pkt) u recv(pkt) u recv(pkt) and pkt is good R1 and pkt is corrupted and seq num(pkt) is 0 u send([ACK,0]∗) u send([ACK,0]∗) c 2005–2008 Antonio Carzaniga
  152. 152. Summary of Principles and Techniques c 2005–2008 Antonio Carzaniga
  153. 153. Summary of Principles and Techniques Error detection codes (checksums) can be used to detect transmission errors c 2005–2008 Antonio Carzaniga
  154. 154. Summary of Principles and Techniques Error detection codes (checksums) can be used to detect transmission errors Retransmission allows us to recover from transmission errors c 2005–2008 Antonio Carzaniga
  155. 155. Summary of Principles and Techniques Error detection codes (checksums) can be used to detect transmission errors Retransmission allows us to recover from transmission errors ACKs and NACKs give feedback to the sender ◮ ACKs and NACKs are also “protected” with an error-detection code c 2005–2008 Antonio Carzaniga
  156. 156. Summary of Principles and Techniques Error detection codes (checksums) can be used to detect transmission errors Retransmission allows us to recover from transmission errors ACKs and NACKs give feedback to the sender ◮ ACKs and NACKs are also “protected” with an error-detection code ◮ corrupted ACKs are interpreded as NACKs, possibly generating duplicate segments c 2005–2008 Antonio Carzaniga
  157. 157. Summary of Principles and Techniques Error detection codes (checksums) can be used to detect transmission errors Retransmission allows us to recover from transmission errors ACKs and NACKs give feedback to the sender ◮ ACKs and NACKs are also “protected” with an error-detection code ◮ corrupted ACKs are interpreded as NACKs, possibly generating duplicate segments Sequence numbers allow the receiver to ignore duplicate data segments c 2005–2008 Antonio Carzaniga
  158. 158. Lossy And Noisy Channel c 2005–2008 Antonio Carzaniga
  159. 159. Lossy And Noisy Channel Reliable transport protocol over a network that may ◮ introduce bit errors ◮ loose packets c 2005–2008 Antonio Carzaniga
  160. 160. Lossy And Noisy Channel Reliable transport protocol over a network that may ◮ introduce bit errors ◮ loose packets How do people deal with such situations? (Think of radio transmissions over a noisy and shared medium. Also, think about what we just did for noisy channels) c 2005–2008 Antonio Carzaniga
  161. 161. Lossy And Noisy Channel Reliable transport protocol over a network that may ◮ introduce bit errors ◮ loose packets How do people deal with such situations? (Think of radio transmissions over a noisy and shared medium. Also, think about what we just did for noisy channels) Detection: the receiver and/or the sender must be able to determine that a packet was lost (how?) c 2005–2008 Antonio Carzaniga
  162. 162. Lossy And Noisy Channel Reliable transport protocol over a network that may ◮ introduce bit errors ◮ loose packets How do people deal with such situations? (Think of radio transmissions over a noisy and shared medium. Also, think about what we just did for noisy channels) Detection: the receiver and/or the sender must be able to determine that a packet was lost (how?) ACKs, retransmission, and sequence numbers: lost packets can be easily treated as corrupted packets c 2005–2008 Antonio Carzaniga
  163. 163. Sender Using Timeouts S0 c 2005–2008 Antonio Carzaniga
  164. 164. Sender Using Timeouts r send(data) data pkt = [0, data]∗ u send(data pkt) start timer() S0 ACK0 c 2005–2008 Antonio Carzaniga
  165. 165. Sender Using Timeouts timeout r send(data) u send(data pkt) data pkt = [0, data]∗ start timer() u send(data pkt) start timer() S0 ACK0 c 2005–2008 Antonio Carzaniga
  166. 166. Sender Using Timeouts timeout r send(data) u send(data pkt) data pkt = [0, data]∗ start timer() u send(data pkt) u recv(pkt) start timer() and (pkt = (ACK, 1) S0 ACK0 or pkt is corrupted) u send(data pkt) start timer() c 2005–2008 Antonio Carzaniga
  167. 167. Sender Using Timeouts timeout r send(data) u send(data pkt) data pkt = [0, data]∗ start timer() u send(data pkt) u recv(pkt) start timer() and (pkt = (ACK, 1) S0 ACK0 or pkt is corrupted) u send(data pkt) start timer() u recv(pkt) and pkt is good and pkt = (ACK, 0) S1 c 2005–2008 Antonio Carzaniga
  168. 168. Sender Using Timeouts timeout r send(data) u send(data pkt) data pkt = [0, data]∗ start timer() u send(data pkt) u recv(pkt) start timer() and (pkt = (ACK, 1) S0 ACK0 or pkt is corrupted) u send(data pkt) start timer() u recv(pkt) and pkt is good and pkt = (ACK, 0) ACK1 S1 r send(data) data pkt = [1, data]∗ u send(data pkt) start timer() c 2005–2008 Antonio Carzaniga
  169. 169. Sender Using Timeouts timeout r send(data) u send(data pkt) data pkt = [0, data]∗ start timer() u send(data pkt) u recv(pkt) start timer() and (pkt = (ACK, 1) S0 ACK0 or pkt is corrupted) u send(data pkt) start timer() u recv(pkt) and pkt is good and pkt = (ACK, 0) ACK1 S1 r send(data) data pkt = [1, data]∗ timeout u send(data pkt) u send(data pkt) start timer() start timer() c 2005–2008 Antonio Carzaniga
  170. 170. Sender Using Timeouts timeout r send(data) u send(data pkt) data pkt = [0, data]∗ start timer() u send(data pkt) u recv(pkt) start timer() and (pkt = (ACK, 1) S0 ACK0 or pkt is corrupted) u send(data pkt) start timer() u recv(pkt) and pkt is good u recv(pkt) and pkt = (ACK, 0) and (pkt = (ACK, 0) or pkt is corrupted) ACK1 S1 u send(data pkt) start timer() r send(data) data pkt = [1, data]∗ timeout u send(data pkt) u send(data pkt) start timer() start timer() c 2005–2008 Antonio Carzaniga
  171. 171. Sender Using Timeouts timeout r send(data) u send(data pkt) data pkt = [0, data]∗ start timer() u send(data pkt) u recv(pkt) start timer() and (pkt = (ACK, 1) S0 ACK0 or pkt is corrupted) u recv(pkt) u send(data pkt) and pkt is good start timer() and pkt = (ACK, 1) u recv(pkt) and pkt is good u recv(pkt) and pkt = (ACK, 0) and (pkt = (ACK, 0) or pkt is corrupted) ACK1 S1 u send(data pkt) start timer() r send(data) data pkt = [1, data]∗ timeout u send(data pkt) u send(data pkt) start timer() start timer() c 2005–2008 Antonio Carzaniga
  172. 172. Part II Efficient and Reliable Streams c 2005–2008 Antonio Carzaniga
  173. 173. Quantifying Data Transfer How do we measure the “speed” and “capacity” of a network connection? c 2005–2008 Antonio Carzaniga
  174. 174. Quantifying Data Transfer How do we measure the “speed” and “capacity” of a network connection? Intuition ◮ water moves in a pipeline ◮ cars move on a road c 2005–2008 Antonio Carzaniga
  175. 175. Quantifying Data Transfer How do we measure the “speed” and “capacity” of a network connection? Intuition ◮ water moves in a pipeline ◮ cars move on a road Latency ◮ the time it takes for one bit to go through the connection (from one end to the other) c 2005–2008 Antonio Carzaniga
  176. 176. Quantifying Data Transfer How do we measure the “speed” and “capacity” of a network connection? Intuition ◮ water moves in a pipeline ◮ cars move on a road Latency ◮ the time it takes for one bit to go through the connection (from one end to the other) Throughput ◮ the amount of information that can get into (or out of) the connection in a time unit ◮ at “steady-state” we assume zero accumulation of traffic, therefore the input throughput is the same as the output throughput c 2005–2008 Antonio Carzaniga
  177. 177. Latency and Throughput connection c 2005–2008 Antonio Carzaniga
  178. 178. Latency and Throughput connection message 100 · · · 110 c 2005–2008 Antonio Carzaniga
  179. 179. Latency and Throughput connection 100 · · · 110 t0 c 2005–2008 Antonio Carzaniga
  180. 180. Latency and Throughput connection 100 · · · 110 t0 t1 c 2005–2008 Antonio Carzaniga
  181. 181. Latency and Throughput connection 100 · · · 110 t0 t1 t2 c 2005–2008 Antonio Carzaniga
  182. 182. Latency and Throughput connection n bits 100 · · · 110 t0 t1 t2 c 2005–2008 Antonio Carzaniga
  183. 183. Latency and Throughput connection n bits 100 · · · 110 t0 t1 t2 Latency L = t1 − t0 sec c 2005–2008 Antonio Carzaniga
  184. 184. Latency and Throughput connection n bits 100 · · · 110 t0 t1 t2 Latency L = t1 − t0 sec n Throughput T = bits/sec t2 − t1 c 2005–2008 Antonio Carzaniga
  185. 185. Latency and Throughput connection n bits 100 · · · 110 t0 t1 t2 Latency L = t1 − t0 sec n Throughput T = bits/sec t2 − t1 n Transfer time ∆ = L+ sec T c 2005–2008 Antonio Carzaniga
  186. 186. Examples How long does it take to tranfer a file between, say, Lugano and St. Petersburg? c 2005–2008 Antonio Carzaniga
  187. 187. Examples How long does it take to tranfer a file between, say, Lugano and St. Petersburg? How big is this file? And how fast is our connection? c 2005–2008 Antonio Carzaniga
  188. 188. Examples How long does it take to tranfer a file between, say, Lugano and St. Petersburg? How big is this file? And how fast is our connection? E.g., a (short) e-mail message S = 4Kb L = 500ms T = 1Mb/s ∆ = ? c 2005–2008 Antonio Carzaniga
  189. 189. Examples How long does it take to tranfer a file between, say, Lugano and St. Petersburg? How big is this file? And how fast is our connection? E.g., a (short) e-mail message S = 4Kb L = 500ms T = 1Mb/s ∆ = 500ms + 4ms = 504ms c 2005–2008 Antonio Carzaniga
  190. 190. Examples How about a big file? (E.g., a CD) c 2005–2008 Antonio Carzaniga
  191. 191. Examples How about a big file? (E.g., a CD) S = 400Mb L = 500ms T = 1Mb /s ∆ = ? c 2005–2008 Antonio Carzaniga
  192. 192. Examples How about a big file? (E.g., a CD) S = 400Mb L = 500ms T = 1Mb /s ∆ = 500ms + 400s = 400.5s = 6′ 40′′ c 2005–2008 Antonio Carzaniga
  193. 193. Examples How about a big file? (E.g., a CD) S = 400Mb L = 500ms T = 1Mb /s ∆ = 500ms + 400s = 400.5s = 6′ 40′′ How about a bigger file? (E.g., 10 DVDs) c 2005–2008 Antonio Carzaniga
  194. 194. Examples How about a big file? (E.g., a CD) S = 400Mb L = 500ms T = 1Mb /s ∆ = 500ms + 400s = 400.5s = 6′ 40′′ How about a bigger file? (E.g., 10 DVDs) S = 40Gb L = 500ms T = 1Mb /s ∆ = ? c 2005–2008 Antonio Carzaniga
  195. 195. Examples How about a big file? (E.g., a CD) S = 400Mb L = 500ms T = 1Mb /s ∆ = 500ms + 400s = 400.5s = 6′ 40′′ How about a bigger file? (E.g., 10 DVDs) S = 40Gb L = 500ms T = 1Mb /s ∆ = ǫ + 40000s = 11h 6′ 40′′ c 2005–2008 Antonio Carzaniga
  196. 196. Examples How about flying to St. Petersburgh? c 2005–2008 Antonio Carzaniga
  197. 197. Examples How about flying to St. Petersburgh? ◮ assuming you can carry more or less 100 DVDs in your backpack ◮ assuming it takes you four seconds to take the DVDs out of your backpack c 2005–2008 Antonio Carzaniga
  198. 198. Examples How about flying to St. Petersburgh? ◮ assuming you can carry more or less 100 DVDs in your backpack ◮ assuming it takes you four seconds to take the DVDs out of your backpack S = 40Gb L = ? T = ∆ = c 2005–2008 Antonio Carzaniga
  199. 199. Examples How about flying to St. Petersburgh? ◮ assuming you can carry more or less 100 DVDs in your backpack ◮ assuming it takes you four seconds to take the DVDs out of your backpack S = 40Gb L = 6h T = ? ∆ = c 2005–2008 Antonio Carzaniga
  200. 200. Examples How about flying to St. Petersburgh? ◮ assuming you can carry more or less 100 DVDs in your backpack ◮ assuming it takes you four seconds to take the DVDs out of your backpack S = 40Gb L = 6h T = 100Gb /s ∆ = ? c 2005–2008 Antonio Carzaniga
  201. 201. Examples How about flying to St. Petersburgh? ◮ assuming you can carry more or less 100 DVDs in your backpack ◮ assuming it takes you four seconds to take the DVDs out of your backpack S = 40Gb L = 6h T = 100Gb /s ∆ = 6h c 2005–2008 Antonio Carzaniga
  202. 202. Examples How about flying to St. Petersburgh? ◮ assuming you can carry more or less 100 DVDs in your backpack ◮ assuming it takes you four seconds to take the DVDs out of your backpack S = 40Gb L = 6h T = 100Gb /s ∆ = 6h If you need to transfer 10 DVDs from Lugano to St. Petersburg and time is of the essence (and you have plenty of money). . . then you’re better off talking a plane rather than using the Internet c 2005–2008 Antonio Carzaniga
  203. 203. Back to Reliable Data Tranfer c 2005–2008 Antonio Carzaniga
  204. 204. Back to Reliable Data Tranfer r send(data) timeout data pkt = [0, data] ∗ u send(data pkt) u send(data pkt) start timer() start timer() u recv(pkt) u recv(pkt) S0 ACK0 and (pkt is corrupted or pkt = (ACK, 1)) u recv(pkt) u recv(pkt) and pkt is good and pkt is good and pkt = (ACK, 1) and pkt = (ACK, 0) u recv(pkt) and (pkt is corrupted ACK1 S1 u recv(pkt) or pkt = (ACK, 0)) r send(data) timeout data pkt = [1, data]∗ u send(data pkt) u send(data pkt) start timer() start timer() c 2005–2008 Antonio Carzaniga
  205. 205. Back to Reliable Data Tranfer r send(data) timeout data pkt = [0, data] ∗ u send(data pkt) u send(data pkt) start timer() start timer() u recv(pkt) u recv(pkt) S0 ACK0 and (pkt is corrupted or pkt = (ACK, 1)) u recv(pkt) u recv(pkt) and pkt is good and pkt is good and pkt = (ACK, 1) and pkt = (ACK, 0) u recv(pkt) and (pkt is corrupted ACK1 S1 u recv(pkt) or pkt = (ACK, 0)) r send(data) timeout data pkt = [1, data]∗ u send(data pkt) u send(data pkt) start timer() start timer() c 2005–2008 Antonio Carzaniga
  206. 206. Back to Reliable Data Tranfer r send(data) timeout data pkt = [0, data] ∗ u send(data pkt) u send(data pkt) start timer() start timer() u recv(pkt) u recv(pkt) S0 ACK0 and (pkt is corrupted or pkt = (ACK, 1)) u recv(pkt) u recv(pkt) and pkt is good and pkt is good and pkt = (ACK, 1) and pkt = (ACK, 0) u recv(pkt) and (pkt is corrupted ACK1 S1 u recv(pkt) or pkt = (ACK, 0)) r send(data) timeout data pkt = [1, data]∗ u send(data pkt) u send(data pkt) start timer() start timer() c 2005–2008 Antonio Carzaniga
  207. 207. Back to Reliable Data Tranfer r send(data) timeout data pkt = [0, data] ∗ u send(data pkt) u send(data pkt) start timer() start timer() u recv(pkt) u recv(pkt) S0 ACK0 and (pkt is corrupted or pkt = (ACK, 1)) u recv(pkt) u recv(pkt) and pkt is good and pkt is good and pkt = (ACK, 1) and pkt = (ACK, 0) u recv(pkt) and (pkt is corrupted ACK1 S1 u recv(pkt) or pkt = (ACK, 0)) r send(data) timeout data pkt = [1, data]∗ u send(data pkt) u send(data pkt) start timer() start timer() c 2005–2008 Antonio Carzaniga
  208. 208. Back to Reliable Data Tranfer r send(data) timeout data pkt = [0, data] ∗ u send(data pkt) u send(data pkt) start timer() start timer() u recv(pkt) u recv(pkt) S0 ACK0 and (pkt is corrupted or pkt = (ACK, 1)) u recv(pkt) u recv(pkt) and pkt is good and pkt is good and pkt = (ACK, 1) and pkt = (ACK, 0) u recv(pkt) and (pkt is corrupted ACK1 S1 u recv(pkt) or pkt = (ACK, 0)) r send(data) timeout data pkt = [1, data]∗ u send(data pkt) u send(data pkt) start timer() start timer() c 2005–2008 Antonio Carzaniga
  209. 209. Back to Reliable Data Tranfer r send(data) timeout data pkt = [0, data] ∗ u send(data pkt) u send(data pkt) start timer() start timer() u recv(pkt) u recv(pkt) S0 ACK0 and (pkt is corrupted or pkt = (ACK, 1)) u recv(pkt) u recv(pkt) and pkt is good and pkt is good and pkt = (ACK, 1) and pkt = (ACK, 0) u recv(pkt) and (pkt is corrupted ACK1 S1 u recv(pkt) or pkt = (ACK, 0)) r send(data) timeout data pkt = [1, data]∗ u send(data pkt) u send(data pkt) start timer() start timer() c 2005–2008 Antonio Carzaniga
  210. 210. Back to Reliable Data Tranfer r send(data) timeout data pkt = [0, data] ∗ u send(data pkt) u send(data pkt) start timer() start timer() u recv(pkt) u recv(pkt) S0 ACK0 and (pkt is corrupted or pkt = (ACK, 1)) u recv(pkt) u recv(pkt) and pkt is good and pkt is good and pkt = (ACK, 1) and pkt = (ACK, 0) u recv(pkt) and (pkt is corrupted ACK1 S1 u recv(pkt) or pkt = (ACK, 0)) r send(data) timeout data pkt = [1, data]∗ u send(data pkt) u send(data pkt) start timer() start timer() c 2005–2008 Antonio Carzaniga
  211. 211. Back to Reliable Data Tranfer r send(data) timeout data pkt = [0, data] ∗ u send(data pkt) u send(data pkt) start timer() start timer() u recv(pkt) u recv(pkt) S0 ACK0 and (pkt is corrupted or pkt = (ACK, 1)) u recv(pkt) u recv(pkt) and pkt is good and pkt is good and pkt = (ACK, 1) and pkt = (ACK, 0) u recv(pkt) and (pkt is corrupted ACK1 S1 u recv(pkt) or pkt = (ACK, 0)) r send(data) timeout data pkt = [1, data]∗ u send(data pkt) u send(data pkt) start timer() start timer() c 2005–2008 Antonio Carzaniga
  212. 212. Back to Reliable Data Tranfer r send(data) timeout data pkt = [0, data] ∗ u send(data pkt) u send(data pkt) start timer() start timer() u recv(pkt) u recv(pkt) S0 ACK0 and (pkt is corrupted or pkt = (ACK, 1)) u recv(pkt) u recv(pkt) and pkt is good and pkt is good and pkt = (ACK, 1) and pkt = (ACK, 0) u recv(pkt) and (pkt is corrupted ACK1 S1 u recv(pkt) or pkt = (ACK, 0)) r send(data) timeout data pkt = [1, data]∗ u send(data pkt) u send(data pkt) start timer() start timer() c 2005–2008 Antonio Carzaniga
  213. 213. Back to Reliable Data Tranfer r send(data) timeout data pkt = [0, data] ∗ u send(data pkt) u send(data pkt) start timer() start timer() u recv(pkt) u recv(pkt) S0 ACK0 and (pkt is corrupted or pkt = (ACK, 1)) u recv(pkt) u recv(pkt) and pkt is good and pkt is good and pkt = (ACK, 1) and pkt = (ACK, 0) u recv(pkt) and (pkt is corrupted ACK1 S1 u recv(pkt) or pkt = (ACK, 0)) r send(data) timeout data pkt = [1, data]∗ u send(data pkt) u send(data pkt) start timer() start timer() c 2005–2008 Antonio Carzaniga
  214. 214. Network Usage sender receiver r send(pkt1 ) c 2005–2008 Antonio Carzaniga
  215. 215. Network Usage sender receiver r send(pkt1 ) u send([pkt1 ,0]) c 2005–2008 Antonio Carzaniga
  216. 216. Network Usage sender receiver r send(pkt1 ) u send([pkt1 ,0]) [pkt 1 ,0 ] c 2005–2008 Antonio Carzaniga
  217. 217. Network Usage sender receiver r send(pkt1 ) u send([pkt1 ,0]) [pkt 1 ,0 ] u send([ACK,0]) r recv(pkt1 ) c 2005–2008 Antonio Carzaniga
  218. 218. Network Usage sender receiver r send(pkt1 ) u send([pkt1 ,0]) [pkt 1 ,0 ] u send([ACK,0]) ,0 ] [ACK r recv(pkt1 ) c 2005–2008 Antonio Carzaniga
  219. 219. Network Usage sender receiver r send(pkt1 ) u send([pkt1 ,0]) [pkt 1 ,0 ] u send([ACK,0]) ,0 ] r send(pkt2 ) [ACK r recv(pkt1 ) c 2005–2008 Antonio Carzaniga
  220. 220. Network Usage sender receiver r send(pkt1 ) u send([pkt1 ,0]) [pkt 1 ,0 ] u send([ACK,0]) ,0 ] r send(pkt2 ) [ACK r recv(pkt1 ) u send([pkt2 ,1]) c 2005–2008 Antonio Carzaniga
  221. 221. Network Usage sender receiver r send(pkt1 ) u send([pkt1 ,0]) [pkt 1 ,0 ] u send([ACK,0]) ,0 ] r send(pkt2 ) [ACK r recv(pkt1 ) u send([pkt2 ,1]) [pkt 2 ,1 ] c 2005–2008 Antonio Carzaniga

×