week5 lec3-bscs1

21
Chapter 3 Transport Layer Computer Networking: A Top Down Approach, 4 th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007.

Upload: syedhaiderraza

Post on 18-Dec-2014

62 views

Category:

Education


0 download

DESCRIPTION

Computer Networks

TRANSCRIPT

Page 1: Week5 lec3-bscs1

Chapter 3Transport Layer

Computer Networking: A Top Down Approach, 4th edition. Jim Kurose, Keith RossAddison-Wesley, July 2007.

Page 2: Week5 lec3-bscs1

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

Page 3: Week5 lec3-bscs1

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

Page 4: Week5 lec3-bscs1

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

Page 5: Week5 lec3-bscs1

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.

Receiver discards out of order packets No receiver buffering Need only remember expectedseqnum

Page 7: Week5 lec3-bscs1

Selective Repeat Selective Repeat protocol avoid unnecessary

retransmissionso Sender only retransmits packets that were lost or

are in erroro A window size N is used to limit the no of

outstanding unacknowledged packets in the pipeline

Page 8: Week5 lec3-bscs1

Selective Repeat

Sender: Data received from upper layers

o If window is full, returns data to upper layero Maintain synchronization mechanism

Timeouto Each packet has its own timero Single packet is retransmitted on timeout

ACK received:o Sender marked packet as received provided its in

the windowo Packets sequence no is equal to send_base,

• The window base is moved forward to the unacknowledged packet

Page 9: Week5 lec3-bscs1

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

Page 10: Week5 lec3-bscs1

Selective Repeat in Action

http://www.eecis.udel.edu/~amer/450/TransportApplets/SR/SRindex.html

Page 11: Week5 lec3-bscs1

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

Page 12: Week5 lec3-bscs1

TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 Connection Oriented

HandshakeSend 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

Page 13: Week5 lec3-bscs1

TCP Segment Structure

source port # dest port #

application data (variable length)

sequence number

acknowledgement number Receive window

Urg data pointerchecksumFSRPAU

headlen

notused

Options (variable length)

URG: urgent data

ACK?

PSH?

RST, SYN, FIN:connection estab(setup, teardown

commands)

Used for flow control

Used in implementinga reliable data transfer

Same as in UDP

To negotiate maximum

segment size etc. Find more out about OPTONS? (SEE RFC 853, RFC 1323)

Page 14: Week5 lec3-bscs1

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

Page 15: Week5 lec3-bscs1

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?

Page 16: Week5 lec3-bscs1

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)

TCP Sequence Numbers

Page 17: Week5 lec3-bscs1

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 rulesTwo choices

o The receiver discards out of order segmentso Keeps out of order bytes and waits for missing bytes to

fill

Page 18: Week5 lec3-bscs1

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

Seq=42, ACK=79, data = ‘C’

Seq=79, ACK=43, data = ‘C’

Seq=43, ACK=80

Usertypes‘C’

host ACKsreceipt of echoed‘C’

host ACKsreceipt of‘C’, echoesback ‘C’

time

Piggybacked

Page 19: Week5 lec3-bscs1

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

Page 20: Week5 lec3-bscs1

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

Page 21: Week5 lec3-bscs1

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