2. Pipelined Reliable Data Transfer Protocols
Pipelining has the following consequences for
reliable data transfer
Range of sequence numbers must be increased
Sender and receiver sides may have to buffer
more than one packet.
Two basic approaches towards pipeline error
recovery:
Go-Back-N, Selective Repeat
3. Go-Back-N (GBN)
Sender:
Sender is allowed to transmit multiple packets without waiting
for an acknowledgement
Constrained to a certain maximum number N.
Base or send_base
Sequence number of oldest unacknowledged packet
Nextseqnum
Sequence number of next packet to be sent
The range of sequence numbers for transmitted but not
acknowledged packets can be viewed as a window of size N.
This window slides forward as the protocol operates
4. Go-Back-N
GBN sender must respond to three types of events
Invocation from above (rdt_send() is called):
If window is full, returns data to upper layer
Maintain synchronization mechanism
Receipt of an ACK:
ACK for packet with seq # n is taken as“Cumulative ACK”
More shortly in receiver
Time out event:
Sender has timer for oldest unacknowledged packet
• If timer expires, retransmit all unacknowledged packets
5. Go-Back-N
Receiver:
If a packet with seq # n is received correctly and is in
order
ACK is sent and data is delivered to upper layers
For all other cases
Receiver discards the packet and resends ACK for most
recently received in order packet
Packets are delivered one at a time to upper layers
If a packet k has been received and delivered, then all
packets with seq # lower than k have also been delivered.
r Receiver discards out of order packets
No receiver buffering
Need only remember expectedseqnum
7. Selective Repeat
Selective Repeat protocol avoid unnecessary
retransmissions
o Sender only retransmits packets that were lost or are
in error
o A window size N is used to limit the no of outstanding
unacknowledged packets in the pipeline
8. Selective Repeat
Sender:
Data received from upper layers
o If window is full, returns data to upper layer
o Maintain synchronization mechanism
Timeout
o Each packet has its own timer
o Single packet is retransmitted on timeout
ACK received:
o Sender marked packet as received provided its in the
window
o Packets sequence no is equal to send_base,
• The window base is moved forward to the unacknowledged
packet
9. Selective Repeat
Receiver:
Packets with sequence no in the window
Selective ACK is sent to the sender whether or not it is
in order.
Out-of-order: buffer but send ACK for that packet
Deliver base plus buffered packets
Packets with sequence number below the window
base
An ACK must be generated even though the packet has
already been acknowledged by the receiver
10. Selective Repeat in Action
http://www.eecis.udel.edu/~amer/450/TransportApplets/SR/SRindex.html
11. Selective Repeat:
Dilemma
Finite range of sequence
numbers
Example:
Seq #‟s: 0, 1, 2, 3
Window size=3
Receiver sees no difference in
two scenarios!
Incorrectly passes duplicate
data as new in (a)
Window size of one less than
the sequence number space
does not work
Window size must be less than
or equal to half the size of
sequence no. space
12. TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581
Connection Oriented
Handshake
Send segments to each other to establish
parameters of ensuing data transfer
Runs on the end systems
TCP connection is point to point (single sender
and receiver)
Does not support multicast (one sender many
receivers)
TCP send buffer
TCP grab a chunk of data from this buffer
MSS (Maximum Segment Size)
The maximum amount of data that can be
grabbed and placed in a segment
TCP receive buffer
13. TCP Segment Structure
URG: urgent data
ACK?
PSH?
RST, SYN, FIN:
connection estab
(setup, teardown
commands)
Same as in UDP
To negotiate maximum
segment size etc.
source port #
dest port #
sequence number
acknowledgement number
head not
len used
UAP R S F Receive window
Urg data pointer
checksum
Options (variable length)
Used in
implementing
a reliable
data transfer
Used for
flow control
application
data
(variable length)
Find more out about OPTONS? (SEE RFC 853, RFC 1323)
14. TCP Sequence Numbers and ACKs
Sequence Numbers:
Sequence nos. are over the stream of transmitted
bytes and not over the series of transmitted
segments
Sequence no. is the byte stream “number” of first
byte in segment‟s data
Example:
Host A wants to send data to Host B
File consisting of 500,000 bytes, MSS is 1,000 bytes
First byte of stream is numbered zero
TCP constructs 500 segments out of data stream
First segment gets sequence number --- 0
Second segment gets sequence number----1000
Third segment gets sequence number------2000 and so on
15. TCP Sequence Numbers
Imagine a TCP connection is transferring a file of
6000 bytes. The first byte is numbered 10010. What
are the sequence numbers for each segment if data is
sent in five segments with the first four segments
carrying 1,000 bytes and the last segment carrying
2,000 bytes?
16. TCP Sequence Numbers
Solution:
The following shows the sequence number for
each segment:
Segment 1 10,010
(10,010 to 11,009)
Segment 2 11,010
(11,010 to 12,009)
Segment 3 12,010
(12,010 to 13,009)
Segment 4 13,010
(13,010 to 14,009)
Segment 5 14,010
(14,010 to 16,009)
17. TCP ACKs
Acknowledgement Numbers:
The acknowledgement no that hosts A puts in its segment is
the sequence no of the next byte host A is expecting from
host B.
Example
Host A receives all bytes numbered 0 through 535 from B
Host A puts 536 in the acknowledgment number field of the
segment it sends to B
TCP acknowledges bytes up to first missing bytes in the stream
Cumulative Acknowledgement
How receiver handles out-of-order segments?
TCP RFCs do not impose any rules
Two choices
o The receiver discards out of order segments
o Keeps out of order bytes and waits for missing bytes to fill
18. TCP Sequence Numbers and ACKs
Example:
Host A sends a
character to Host B,
which echoes it back to
Host A.
Starting Sequence no
for client and server are
42 and 79.
Piggybacking:
Acknowledgement of
client to server data is
carried by segment of
server to client data
Host A
Host B
User
types
„C‟
host ACKs
receipt
of echoed
„C‟
host ACKs
receipt of
„C‟, echoes
back „C‟
Piggybacked
time
19. TCP Flow Control
Eliminate the possibility of sender overflowing
receiver‟s buffer by transmitting too much, too
fast.
Sender maintains a variable receive window
– Gives the sender an idea of how much free space is
available at receiver
Example
Host A is sending a large file to host B
Host B allocates a receive buffer and denotes size by
RcvBuffer
LastByteRead
The number of the last byte read from buffer by
process in Host B
LastByteRcvd:
The number of last byte that has been placed in buffer
at B
20. TCP Flow Control
RcvWindow is set to the amount of spare room in the buffer
RcvWindow= RcvBuffer - [LastByteRcvd - LastByteRead]
Host B informs Host A about how much spare room it has in
the connection buffer.
Places RcvWindow in the receive window field of every segment
Host A keeps track of two variables
LastByteSent and LastByteAcked
21. TCP Flow Control
LastByteSent – LastByteAcked
– It is the amount of unacknowledged data that A has sent
into the connection
LastByteSent – LastByteAcked
RcvWindow
– Keeping the unacknowledged data less than the value of
RcvWindow
Suppose RcvWindow=0
– Host B advertises RcvWindow=0 to Host A
– Suppose Host B has nothing to send to host A
– TCP specification require Host A to send one byte of data
Persistence Timer? Home Assignment