0% found this document useful (0 votes)
20 views22 pages

Lec 3 - Transport Layer - VI - TCP

This document outlines the key aspects of the Transport Layer, focusing on TCP (Transmission Control Protocol). It discusses TCP segments, reliable data transfer, connection establishment, flow control, congestion control, sequence numbers and acknowledgement numbers. TCP provides reliable, in-order delivery of a byte stream between two endpoints and uses mechanisms like sequencing, acknowledgements, timeouts and retransmissions to ensure reliable data transfer.

Uploaded by

Hamna Younis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views22 pages

Lec 3 - Transport Layer - VI - TCP

This document outlines the key aspects of the Transport Layer, focusing on TCP (Transmission Control Protocol). It discusses TCP segments, reliable data transfer, connection establishment, flow control, congestion control, sequence numbers and acknowledgement numbers. TCP provides reliable, in-order delivery of a byte stream between two endpoints and uses mechanisms like sequencing, acknowledgements, timeouts and retransmissions to ensure reliable data transfer.

Uploaded by

Hamna Younis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Computer and

Communication Networks
EE-357
By Dr Mir Yasir Umair
Associate Professor, MCS, NUST
Transport Layer
TCP Segments
Chapter 3 outline
3.1 transport-layer services 3.5 connection-oriented
3.2 multiplexing and demultiplexing transport: TCP
▪ segment structure
3.3 connectionless transport: UDP ▪ reliable data transfer
3.4 principles of reliable data transfer ▪ flow control
▪ connection management

3.6 principles of congestion


control
3.7 TCP congestion control

Transport Layer 3-3


TCP: Overview
• point-to-point: ❖ full duplex data:
o one sender, one receiver ▪ bi-directional data flow in
same connection
• reliable, in-order byte ▪ MSS: maximum segment size
steam:
o no “message boundaries”
❖ connection-oriented:
▪ handshaking (exchange of
• pipelined: control msgs) inits sender,
o TCP congestion and flow receiver state before data
control set window size exchange

❖ flow controlled:
▪ sender will not overwhelm
receiver

Transport Layer 3-4


TCP: Overview
MSS – Maximum Segment Size is the length in bytes of largest
frame that can be sent by the sending side

Example: If Size of file: 500,000 bytes and MSS = 1000 bytes


• # of segments = 500

• Seq #
o 1st segment = 0
o 2nd segment = 1000
o 3rd segment = 2000
TCP segment structure
32 bits
URG: urgent data counting
(generally not used) source port # dest port #
by bytes
sequence number of data
ACK: ACK #
valid acknowledgement number (not segments!)
head not
PSH: push data now len used
UAP R S F receive window
(generally not used) # bytes
checksum Urg data pointer
rcvr willing
RST, SYN, FIN: to accept
options (variable length)
connection estab
(setup, teardown
commands)
application
Internet data
checksum (variable length)
(as in UDP)

Transport Layer 3-6


TCP segment structure
• Source Port (16 bits): Identifies source user process
• Destination Port (16 bits)
• Sequence Number (32 bits): Sequence number of the first byte in
the segment. .
• ACK number (32 bits): Next byte expected
• Data offset (4 bits): length of header in terms of 32-bit words
• Reserved (6 bits)
• Checksum (16 bits)
TCP segment structure
• Flags (6 bits):
o URG = Urgent pointer field significant,
o ACK = ack field significant,
o PSH = push function,
o RST = reset the connection,
o SYN = synchronize the sequence numbers,
o FIN = no more data from sender
• Window (16 bits): for flow control - # of bytes receiver is willing
to accept
• Urgent pointer (16 bits): Points to the byte following urgent data.
Let receiver know how much urgent data is coming.
TCP seq. numbers, ACKs
outgoing segment from sender
sequence numbers: source port #
sequence number
dest port #

o byte stream “number” of first acknowledgement number


byte in segment’s data rwnd
checksum urg pointer
acknowledgements: window size
o seq # of next byte expected N
from other side
o cumulative ACK

Q: how receiver handles sender sequence number space

out-of-order segments sent sent, not- usable not


o A: TCP spec doesn’t say, - up ACKed yet ACKed but not usable
(“in- yet sent
to implementor flight”)
incoming segment to sender
source port # dest port #
sequence number
acknowledgement number
A rwnd
checksum urg pointer

Transport Layer 3-9


TCP seq. numbers, ACKs
Host A Host B

User
types
‘C’ Seq=42, ACK=79, data = ‘C’
host ACKs
receipt of
‘C’, echoes
Seq=79, ACK=43, data = ‘C’ back ‘C’
host ACKs
receipt
of echoed
‘C’ Seq=43, ACK=80

simple telnet scenario

Transport Layer 3-10


TCP round trip time, timeout
Q: how to set TCP Q: how to estimate RTT?
timeout value? • SampleRTT: measured
time from segment
❖ longer than RTT
▪ but RTT varies transmission until ACK
❖ too short: premature receipt
o ignore retransmissions
timeout, unnecessary
retransmissions • SampleRTT will vary,
❖ too long: slow want estimated RTT
reaction to segment “smoother”
loss o average several recent
measurements, not just current
SampleRTT

Transport Layer 3-11


TCP round trip time, timeout
EstimatedRTT = (1- )*EstimatedRTT + *SampleRTT
❖ exponential weighted moving average
❖ influence of past sample decreases exponentially fast
❖ typical value:  = 0.125 RTT: gaia.cs.umass.edu to fantasia.eurecom.fr

350

RTT (milliseconds) RTT: gaia.cs.umass.edu to fantasia.eurecom.fr

300

250
RTT (milliseconds)

200

sampleRTT
150

EstimatedRTT

100
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds) 3-12
Transport Layer time (seconds)
SampleRTT Estimated RTT
TCP round trip time, timeout
• timeout interval: EstimatedRTT plus “safety
margin”
o large variation in EstimatedRTT -> larger safety margin
• estimate SampleRTT deviation from EstimatedRTT:
DevRTT = (1-)*DevRTT +
*|SampleRTT-EstimatedRTT|
(typically,  = 0.25)

TimeoutInterval = EstimatedRTT + 4*DevRTT

estimated RTT “safety margin”

Transport Layer 3-13


Chapter 3 outline
3.1 transport-layer services 3.5 connection-oriented
3.2 multiplexing and demultiplexing transport: TCP
▪ segment structure
3.3 connectionless transport: UDP ▪ reliable data transfer
3.4 principles of reliable data transfer ▪ flow control
▪ connection management

3.6 principles of congestion


control
3.7 TCP congestion control

Transport Layer 3-14


TCP reliable data transfer
• TCP creates rdt service
on top of IP’s
unreliable service
o pipelined segments
o cumulative acks
o single retransmission timer

• retransmissions
triggered by:
o timeout events
o duplicate acks

Transport Layer 3-15


TCP sender events:
data rcvd from app: timeout:
❖ create segment with ❖ retransmit segment
seq # that caused timeout
❖ seq # is byte-stream ❖ restart timer
number of first data ack rcvd:
byte in segment ❖ if ack acknowledges
❖ start timer if not previously unacked
already running segments
▪ think of timer as for oldest ▪ update what is known to be
unacked segment ACKed
▪ expiration interval: ▪ start timer if there are still
TimeOutInterval unacked segments

Transport Layer 3-16


TCP: retransmission scenarios
Host A Host B Host A Host B

SendBase=92
Seq=92, 8 bytes of data Seq=92, 8 bytes of data

Seq=100, 20 bytes of data


timeout

timeout
ACK=100
X
ACK=100
ACK=120

Seq=92, 8 bytes of data Seq=92, 8


SendBase=100 bytes of data
SendBase=120
ACK=100
ACK=120

SendBase=120

lost ACK scenario premature timeout


Transport Layer 3-17
TCP: retransmission scenarios
Host A Host B

Seq=92, 8 bytes of data

Seq=100, 20 bytes of data


timeout

ACK=100
X
ACK=120

Seq=120, 15 bytes of data

cumulative ACK
Transport Layer 3-18
TCP fast retransmit
❖ time-out period often
relatively long: TCP fast retransmit
▪ long delay before resending if sender receives 3
lost packet
ACKs for same data
❖ detect lost segments
(“triple
(“triple duplicate
duplicate ACKs”),
ACKs”),
via duplicate ACKs.
▪ sender often sends many
resend unacked
segments back-to-back segment with smallest
▪ if segment is lost, there will
likely be many duplicate
seq #
ACKs. ▪ likely that unacked
segment lost, so don’t
wait for timeout

Transport Layer 3-19


TCP fast retransmit
Host A Host B

Seq=92, 8 bytes of data


Seq=100, 20 bytes of data
X

ACK=100

timeout
ACK=100
ACK=100
ACK=100
Seq=100, 20 bytes of data

fast retransmit after sender


Transport Layer receipt of triple duplicate ACK 3-20
Chapter 3 outline
3.1 transport-layer services 3.5 connection-oriented
3.2 multiplexing and demultiplexing transport: TCP
▪ segment structure
3.3 connectionless transport: UDP ▪ reliable data transfer
3.4 principles of reliable data transfer ▪ flow control
▪ connection management

3.6 principles of congestion


control
3.7 TCP congestion control

Transport Layer 3-21


Thank you

EE 451 Mobile Communications

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy