+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
20080426 networking carzaniga_lecture01-02
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. Outline
Very quick intro to computer networking
The transport layer
◮ reliability
◮ congestion control
◮ brief intro to TCP
c 2005–2008 Antonio Carzaniga
3. Application
web web
browser server
c 2005–2008 Antonio Carzaniga
4. Application
web web
browser server
c 2005–2008 Antonio Carzaniga
5. Application
GET /carzaniga/ HTTP/1.1
Host: www.inf.unisi.ch
...
web web
browser server
c 2005–2008 Antonio Carzaniga
6. Application
web web
browser server
HTTP/1.1 200 OK
...
<html><head>. . . </head><body>
...
c 2005–2008 Antonio Carzaniga
7. Application
GET /carzaniga/anto.png HTTP/1.1
Host: www.inf.unisi.ch
...
web web
browser server
c 2005–2008 Antonio Carzaniga
8. Application
web web
browser server
HTTP/1.1 200 OK
...
...
c 2005–2008 Antonio Carzaniga
9. Transport
web web
browser server
c 2005–2008 Antonio Carzaniga
10. Transport
web web
browser server
c 2005–2008 Antonio Carzaniga
11. Transport
web web
browser server
c 2005–2008 Antonio Carzaniga
12. Network
web web
browser server
c 2005–2008 Antonio Carzaniga
13. Network
web web
browser server
c 2005–2008 Antonio Carzaniga
14. Network
web web
browser server
c 2005–2008 Antonio Carzaniga
39. A “Datagram” Network
Packet-switched network
◮ information is transmitted in discrete units called datagrams
Connectionless service
c 2005–2008 Antonio Carzaniga
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. 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. 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. 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. 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. 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. 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
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. 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. 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. Transport
web web
browser server
c 2005–2008 Antonio Carzaniga
53. Transport
web web
browser server
c 2005–2008 Antonio Carzaniga
54. Transport
web web
browser server
c 2005–2008 Antonio Carzaniga
55. Transport
web web
browser server
unreliable, datagram =⇒ reliable “stream”
c 2005–2008 Antonio Carzaniga
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. 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. 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
62. Finite-State Machines
x
S1 S2
x
States are represented as nodes in a graph
c 2005–2008 Antonio Carzaniga
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. 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. 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
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. 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
70. FSMs to Specify Protocols
States represent the state of a protocol
c 2005–2008 Antonio Carzaniga
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. 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. 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. Back to Reliable Data Transfer
application
Web Web
browser server
c 2005–2008 Antonio Carzaniga
75. Back to Reliable Data Transfer
application
Web Web
browser server
network
best-effort (i.e., unreliable) network
c 2005–2008 Antonio Carzaniga
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. 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. 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. 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
81. Reliable Data Transfer Model
sender receiver
reliable-transfer
protocol
(sender)
c 2005–2008 Antonio Carzaniga
82. Reliable Data Transfer Model
sender receiver
r_send()
reliable-transfer
protocol
(sender)
c 2005–2008 Antonio Carzaniga
83. Reliable Data Transfer Model
sender receiver
r_send()
reliable-transfer
protocol
(sender)
u_send() u_recv()
network
c 2005–2008 Antonio Carzaniga
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. 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. 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. 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
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. 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. 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. 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. 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
95. Error Detection
Key idea: sending redundant information
◮ e.g., the sender could repeat the message twice
c 2005–2008 Antonio Carzaniga
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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. Noisy Channel
Sender
◮ [data]∗ indicates a packet containing data plus an error-detection
code (i.e., a checksum)
c 2005–2008 Antonio Carzaniga
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. 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
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. 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. 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
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. 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. 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. 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. 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. 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. 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. 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. 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
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. 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. 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. 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. 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. 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. 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. 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. 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. 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. Better Use of ACKs
Do we really need both ACKs and NACKs?
c 2005–2008 Antonio Carzaniga
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. 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. 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. 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
141. ACK-Only Protocol: Sender
r send(data)
data pkt = [0, data]∗
u send(data pkt)
S0 ACK0
c 2005–2008 Antonio Carzaniga
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. 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. 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. 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. 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
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. 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. 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. 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
153. Summary of Principles and Techniques
Error detection codes (checksums) can be used to detect
transmission errors
c 2005–2008 Antonio Carzaniga
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. 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. 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. 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
159. Lossy And Noisy Channel
Reliable transport protocol over a network that may
◮ introduce bit errors
◮ loose packets
c 2005–2008 Antonio Carzaniga
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. 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. 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
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. 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. 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. 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. 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. 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. 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. 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
173. Quantifying Data Transfer
How do we measure the “speed” and “capacity” of a network
connection?
c 2005–2008 Antonio Carzaniga
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. 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. 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
182. Latency and Throughput
connection n bits
100 · · · 110
t0 t1 t2
c 2005–2008 Antonio Carzaniga
183. Latency and Throughput
connection n bits
100 · · · 110
t0 t1 t2
Latency L = t1 − t0 sec
c 2005–2008 Antonio Carzaniga
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. 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. Examples
How long does it take to tranfer a file between, say, Lugano and
St. Petersburg?
c 2005–2008 Antonio Carzaniga
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. 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. 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
191. Examples
How about a big file? (E.g., a CD)
S = 400Mb
L = 500ms
T = 1Mb /s
∆ = ?
c 2005–2008 Antonio Carzaniga
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. 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. 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. 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
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. 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. 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. 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. 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. 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
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. 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. 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. 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. 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. 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. 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. 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. 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. 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. Network Usage
sender receiver
r send(pkt1 )
c 2005–2008 Antonio Carzaniga
215. Network Usage
sender receiver
r send(pkt1 )
u send([pkt1 ,0])
c 2005–2008 Antonio Carzaniga
216. Network Usage
sender receiver
r send(pkt1 )
u send([pkt1 ,0])
[pkt
1 ,0 ]
c 2005–2008 Antonio Carzaniga
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. 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. 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. 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. 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