Professional Documents
Culture Documents
Chapter#3
Chapter#3
Transport Layer
our goals:
understand principles behind transport layer services:
• multiplexing, demultiplexing
• reliable data transfer
• flow control
• congestion control
learn about Internet transport layer protocols:
• UDP(User Datagram Protocol): connectionless transport
TCP(Transmission Control Protocol): connection-
oriented reliable transport
Why We Need A Transport Layer?
Since several processes may be running on each host machine, a layer is
needed to be responsible for process-to-process delivery.
Transport layer uses the network layer services and implement its own
internal functions to hide the imperfection and the heterogeneous
nature of the physical network
Transport services and protocols
…
Transport
Layer
TH payload
…
segment
To network layer
many-to-one one-to-many
relationship relationship
application
No congestion control: UDP will package the data inside a UDP
segment and immediately pass the segment to the network layer. TCP
throttles the transport-layer TCP sender when one or more links
between the source and destination hosts become excessively
congested.
UDP: segment header
length, in bytes of
32 bits UDP segment,
source port # dest port # including header
length checksum
application
data
(payload)
1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
Uses of UDP?
Used by a process that requires simple request-response
communication with little concern for flow and error control.
Not used for processes that send a bulk of data such as FTP.
Used by a process with internal flow and error control
mechanisms, ex: Trivial File Transfer Protocol (TFTP).
Multicasting, multicasting capability is embedded in the UDP
software but not in the TCP software.
Management processes, ex: SNMP. Network management
applications must often run when the network is in a stressed
state, when reliable, congestion-controlled data transfer is difficult
to achieve.
routing table updating protocols, ex: RIP.
TCP: Overview
point-to-point:
one sender, one receiver
multicasting (the transfer of data from one sender to many receivers)
in a single send operation—is not possible with TCP.
reliable, in-order byte steam
full duplex data:
bi-directional data flow in same connection
connection-oriented:
handshaking (exchange of control msgs) initiates sender, receiver state
before data exchange.
congestion controlled:
throttle sender when network overloaded
flow controlled:
sender will not overwhelm receiver
Outline
TCP Connection Management
TCP Error Control
TCP Flow & Congestion Control
TCP Segment Structure & Security
TCP Connection Management
The TCP sender and receiver establish a “connection”
with each other before exchanging data segments.
As part of the TCP connection establishment, both sides
will Initialize many TCP state variables, For example:
Sequence numbers.
flow control info.
TCP connection consists of buffers, variables, and a
socket connection to a process in one host, and another
set of buffers, variables, and a socket connection to a
process in another host.
TCP Connection Management
Process running in (client) wants to initiate a connection with
process in (server).
1. The client application process informs the client TCP that it
wants to establish a connection to a process in the server.
2. The TCP in the client proceeds to establish a TCP connection
with the TCP in the server
3. The client and server will allocate the TCP buffers and variables
to the connection
4. Either of the two processes participating in a TCP connection
can end the connection.
5. When a connection ends, the “resources” (buffers and variables)
in the hosts are deallocated.
TCP Connection Management
client server
Three way handshake: Initiate
Aim:
no bit will be received corrupted and no packet will be
lost
Approach:
Retransmission:
1. stop-and-wait
2. pipelined protocols using sliding window
1. Stop-and-Wait ARQ
A transmitter sends a frame then stops and waits for an
acknowledgment.
Sequence number is
necessary to check for
duplicated frames
2. Pipelining
Pipelining: A task is begun before the previous
task has ended
Sequence numbers:
byte stream “number” of first byte in segment’s data
Acknowledgements:
seq # of next byte expected from the other side
TCP sender events
data rcvd from app: timeout:
create segment with seq # retransmit segment that caused
seq # is byte-stream timeout
restart timer
number of first data byte in
segment
start timer if not already ack rcvd:
running if ack acknowledges previously
think of timer as for unacked segments
update what is known to be
oldest unacked segment
ACKed
expiration interval:
restart timer if there are still
TimeOutInterval
unacked segments
TCP: retransmission scenarios
Host A Host B Host A Host B
timeout
Seq=100, 20 bytes of data
ACK=100
X
ACK=100
ACK=120
ACK=100
ACK=120
ACK=100
X
ACK=120
cumulative ACK
Transport Layer 3-44
Fast Retransmit
One of the problems with timeout-triggered retransmissions is
that the timeout period can be relatively long.
When a segment is lost, this long timeout period forces the
sender to delay resending the lost packet, thereby increasing the
end-to-end delay.
The sender can often detect packet loss well before the timeout
event occurs by noting so-called duplicate ACKs.
A duplicate ACK is an ACK that reacknowledges a segment for
which the sender has already received an earlier acknowledgment.
To understand the sender’s response to a duplicate ACK, we must
look at why the receiver sends a duplicate ACK in the first place
(next slide)
TCP receiver’s ACK generation policy
Event at receiver TCP receiver action
Seq=9
2, 8 b
Seq=1 ytes o
00, 20 f data
Seq= b y te s of da
120
Seq = , 15 bytes ta
X
135, 6 o
Seq = bytes f data
141, 1
fast retransmit after sender 0
6 byte
s
K = 1 0
receipt of triple duplicate ACK, AC
100
timeout
SN= 50
SN= 80
ACK= 110
SN= 110
LOST
Time
SN= 140
SN= 170
ACK= 110
SN= 110
ACK= 200
SN= 200
ACK= 230
SN= 230
ACK= 260
3-50
Sender Receiver
1
SN= 51 - 100
2
SN= 101-150
ACK= 151
4 SN= 201-250
LOST
ACK= 151
SN= 351- 400
ACK= 151
SN= 151- 200
ACK= 201
SN= 201- 250
RTT
Initially cwnd = 1 MSS (maximum
two segme
segment size) Cwnd =2 nts
Double cwnd every RTT (Round-Trip
Time)
Done by incrementing cwnd for four segme
nts
every ACK received Cwnd =4