Docsity

TCP Reliable Data Transfer: Understanding TCP Sender Events and Retransmission Scenarios, Slides of Computer Networks

Partial preview of the text

Download TCP Reliable Data Transfer: Understanding TCP Sender Events and Retransmission Scenarios and more Slides Computer Networks in PDF only on Docsity!

Transport Services

Computer Networks

Lect-

TRANSPORT LAYER

Transport Layer 3-

TCP RELIABLE DATA TRANSFER

»TCP- Brief

» TCP creates rdt service on

top of IP’s unreliable

service

» Pipelined segments

» Cumulative acks

» TCP uses single

retransmission timer

»TCP-Retransmissions

» Triggered by:

timeout events duplicate acks

»Understanding TCP

» Initially consider simplified

TCP sender:

ignore duplicate acks ignore flow control, congestion control

Transport Layer 3-

TCP SENDER EVENTS:

Three major events in TCP

Data rcvd from app:

» Create segment with seq

» seq # is byte-stream number of first data byte in segment

» start timer if not already running (think of timer as for oldest unacked

segment)

» expiration interval: TimeOutInterval

Timeout:

» retransmit segment that caused timeout

» restart timer

Ack rcvd:

» If acknowledges previously unacked segments

» update what is known to be acked

» start timer if there are outstanding segments

Transport Layer 3-

TCP: RETRANSMISSION SCENARIOS

Host A

time

premature timeout

Host B

Seq=92 timeout

Host A

loss

timeout

lost ACK scenario

Host B

X

time

SendBase^ Seq=92 timeout = 100

SendBase = 120

SendBase = 120

Sendbase = 100

Transport Layer 3-

TCP RETRANSMISSION SCENARIOS (MORE)

Host A

loss

timeout

Cumulative ACK scenario

Host B

X

time

SendBase = 120

DOUBLING THE TIMEOUT INTERVAL (RETRANSMISSION TIMOUT RTO)

Timout

 Retransmit not yet acknowledged segment (smallest sequence no)

 Set the new timeout interval = double the previous one

In case of retransmit the normal procedure for time out estimating is

avoided i.e. EstimatedRTT and DevRTT are not used

Called the "back off the timer“

Example

 Current time out = .2 sec (calculated using EstimatedRTT and DevRTT)

 Segment sent with sq # 10, 40, 90

 No ack till timeout

1. Send segment with sq # 10

2. Set timout interval to.

3. No ack till timeout

4. Go to 1 till RTO is 60 sec. or more (upper bound)

Transport Layer 3-

FAST RETRANSMIT 1/

»Time-out period often relatively long:

» long delay before resending lost packet

»Detect lost segments via duplicate ACKs.

» Sender often sends many segments back-to-back

» If segment is lost, there will likely be many duplicate ACKs.

»If sender receives 3 ACKs for the same data, it supposes that

segment after ACKed data was lost:

» fast retransmit: resend segment before timer expires

Transport Layer 3-

CHAPTER 3 OUTLINE

»3.1 Transport-layer services

»3.2 Multiplexing and

demultiplexing

»3.3 Connectionless

transport: UDP

»3.4 Principles of reliable

data transfer

»3.5 Connection-oriented transport: TCP

» segment structure

» reliable data transfer

» flow control

» connection management

»3.6 Principles of congestion control

»3.7 TCP congestion control

SLIDING WINDOW DIAGRAM (EXAMPLE FOR TCP FLOW)

Transport Layer 3-

TCP FLOW CONTROL

»receive side of TCP connection has a receive buffer:

»speed-matching service: matching the send rate to the receiving app’s drain rate

 app process may be slow

at reading from buffer

sender won’t overflow

receiver’s buffer by

transmitting too much,

too fast

flow control

Transport Layer 3-

TCP FLOW CONTROL: HOW IT WORKS

(Suppose TCP receiver discards

out-of-order segments)

»spare room in buffer

= RcvWindow

= RcvBuffer-[LastByteRcvd -

LastByteRead]

»Rcvr advertises spare room by including value of RcvWindow in segments

»Sender limits unACKed data to RcvWindow

» guarantees receive buffer

doesn’t overflow

Transport Layer 3-

TCP CONNECTION MANAGEMENT

Recall: TCP sender, receiver

establish “connection” before

exchanging data segments

»initialize TCP variables:

» seq. #s

» buffers, flow control info

(e.g. RcvWindow )

» client: connection initiator

Socket clientSocket = new Socket("hostname","port

number");

» server: contacted by client

Socket connectionSocket = welcomeSocket.accept();

Three way handshake:

Step 1: client host sends TCP SYN

segment to server

» specifies initial seq

» no data

Step 2: server host receives SYN,

replies with SYNACK segment

» server allocates buffers

» specifies server initial seq.

Step 3: client receives SYNACK,

replies with ACK segment, which may

contain data

Transport Layer 3-

TCP CONNECTION MANAGEMENT (CONT.)

Closing a connection:

client closes socket:

clientSocket.close();

Step 1: client end system sends

TCP FIN control segment to server

Step 2: server receives FIN,

replies with ACK. Closes

connection, sends FIN.

client (^) server

close

close

closed

timed wait