Title: Transport Layer
1Transport Layer
- Introduction
- Flow Control (Credit Allocation)
- Connection Management
- Examples TCP, UDP
2Orientation
- Transport layer protocols are end-to-end
protocols - Transport layer is only implemented at the hosts
3Transport Layer Is ETE
4Transport Layer Overview
- Provides a collection of services
- Reliable/ unreliable, connection-oriented/connecti
onless service - Multiplexing and Demultiplexing
- Flow control and congestion control
- There can be more than one Transport Layer
Protocol in a network (eg TCP , UDP , others on
the Internet) not so for Network Layer protocols
5Transport Layer Overview (Cont.)
- TCP provides connection-oriented reliable
transport, multiplexing and Demultiplexing, flow
and congestion control - UDP provides connectionless unreliable (datagram)
service, and multiplexing and Demultiplexing - TCP provide Byte Stream service
6Transport services and protocols
- provide logical communication between app
processes running on different hosts - transport protocols run in end systems
- transport vs network layer services
- network layer data transfer between end systems
- transport layer data transfer between processes
- relies on, enhances, network layer services
7Transport-layer protocols
- Internet transport services
- reliable, in-order unicast delivery (TCP)
- congestion
- flow control
- connection setup
- unreliable (best-effort), unordered unicast or
multicast delivery UDP - services not available
- real-time
- bandwidth guarantees
- reliable multicast
8Protocol Mechanisms
- Addressing
- Multiplexing
- Flow Control
- Error Control
- Connection Management
- Note The mechanisms needed to implement a
transport service are largely dependent on the
existing network layer service
9Addressing
- An address at the transport layer is typically a
tuple (Station, Port) where - Station is the network address of the host, and
- Port identifies the application
- Recall The ltIP address, port numbergt tuples that
you use in the COMP361 LAB are in fact transport
layer addresses
10TCP Connections
- A transport connection is identified by 4
quantities - Client and server processes Port numbers
- Client and server machines IP addresses
- Port numbers space is divided into two subspaces
- Well Known Port numbers 0 - 1023 (restricted)
- Other numbers to be assigned locally by a host
1024 - 65535 (unrestricted) - Server processes for popular applications are
permanently assigned well known Port numbers
Other processes (client, and unknown server
applications) are assigned numbers on-demand from
the unrestricted pool of Port numbers
11IP Address
Every computer on the Internet must have a unique
address Each IP address is associated with a
specific network for routing purposes
12Subnets
132.170.120.xxx
132.170.xxx.xxx
132.170.108.xxx
132.170.240.xxx
13Socket
Both the sender and receiver are given unique
endpoint identifiers called sockets (combination
of IP address and port) A socket of a node
represents an endpoint of a TCP connection at
that node.
14Facts about Ethernet
Ethernet does not know how to route a packet Each
computer has an Ethernet address (i.e., the NIC
serial number) - 00-15-A4-B9-1D-AB ARP (Address
Resolution Protocol) to convert from an IP
address to Ethernet address No centralized node
maintaining the list of Ethernet addresses
15How to know who is the receiver?
Want to send an IP packet to 132.170.108.5
16How to get an IP address from an Ethernet address
17TCP segment format
18Application Multiplexing
19Multiplexing/demultiplexing
- Recall segment - unit of data exchanged between
transport layer entities - aka TPDU transport protocol data unit
Demultiplexing delivering received segments
(TPDUs)to correct app layer processes
receiver
P3
P4
application-layer data
segment header
P1
P2
segment
H
t
M
segment
20Multiplexing/demultiplexing
gathering data from multiple app processes,
enveloping data with header (later used for
demultiplexing)
32 bits
source port
dest port
- multiplexing/demultiplexing
- based on sender, receiver port numbers, IP
addresses - source, dest port s in each segment
- recall well-known port numbers for specific
applications
other header fields
application data (message)
TCP/UDP segment format
21Multiplexing/demultiplexing examples
WWW client host C
server B
host A
port use simple telnet app
WWW server B
WWW client host A
port use WWW server
22Flow Control
- Why do we need flow control at the transport
layer? - The user of receiving transport entity cannot
keep up with the data flow. - Receiving transport entity itself cannot keep up
with flow of incoming packet. - Result Buffer overflows in the receiving
transport entity.
23Need for Flow Control
24Flow Control at the Transport Layer
- Flow Control at the transport layer is more
complex than flow control at the data link layer - Delays are variable and are longer difficult to
use timeouts effectively - Flow control involves the transport users, the
transport entities, and the network service
25Approaches to Flow Control
- Do Nothing
- TPDUs that overflow the buffer are discarded
- Refuse to accept TPDUs from the network layer
- Requires a backpressure mechanism that pushes
flow control to the network layer - (Fixed) Sliding-window Protocol
- Our well known sliding window scheme
- But
- Withholding acknowledgments in an unreliable
network results in retransmission - Sliding window flow control not effective
- Works well on reliable network
- Failure to receive ACK is taken as flow control
indication
26Credit Allocation Flow Control
- Credit Allocation Flow Control is an extension of
the sliding window flow control. - Main Idea
- Enhance the sliding window protocol by a
mechanism that decouples acknowledgments from
flow control. - Then
- Packets can be acknowledged without granting
permission for new transmissions - Used in many existing transport protocols,
including TCP
27Credit Allocation Flow Control
- Initialization during connection setup
- Set initial window size of receiver
- Receiver both acknowledges TPDUs and grants
credit by sending a message (ACK N, CREDIT M) - ACK N Acknowledges all sequence numbers through
N-1 - CREDIT M Sets the number of credits to M
- Credit is the maximum window size (buffer space
at the receiver)
28Example
29Example
30TCP/UPD Protocols
31TCP Feature Summary
Provides a completely reliable (no data
duplication or loss), connection-oriented,
full-duplex stream transport service that allows
two application programs to form a connection,
send data in either direction and then terminate
the connection.
32Relationship Between TCP and Other Protocols
- TCP on one computer uses IP to communicate with
TCP on another computer
33TCP Overview
- full duplex data
- bi-directional data flow in same connection
- MSS maximum segment size
- connection-oriented
- handshaking (exchange of control msgs) inits
sender, receiver state before data exchange - flow controlled
- sender will not overwhelm receiver
- point-to-point
- one sender, one receiver
- reliable, in-order byte steam
- no message boundaries
- pipelined
- TCP congestion and flow control set window size
- send receive buffers
34Achieving Reliability
- Reliable connection setup
- Reliable data transmission
- Reliable connection shutdown
35Reliable Data Transmission
- Positive Acknowledgement
- Receiver returns short message when data arrives
- Called an acknowledgement
- Retransmission
- Sender starts timer whenever message is
transmitted - If timer expires before acknowledgement arrives,
sender retransmits message - Weve seen this before!
36Retransmission Illustrated
37Error Control at the Transport Layer
- Basic techniques for error recovery are the same
as at the Data Link Layer - Lost or damaged TPDUs are recovered with one of
the ARQ retransmission schemes - Mostly Go-back-N, Selective Repeat.
- Problem The end-to-end delay of TPDUs is
variable. This makes it difficult to set the
timeout values. - Small timeout value unnecessary retransmissions.
- Large timeout value low throughput.
- Most transport protocols have adaptive timers
38How Long Should TCP Wait Before Retransmitting?
- Time for ACK to arrive depends on
- Distance to destination
- Current traffic conditions
- Multiple connections can be open simultaneously
- Traffic conditions change rapidly
39Important Point
The delay required for data to reach a
destination and an acknowledgement to return
depends on traffic in the Internet as well as the
distance to the destination. Since it allows
multiple application programs to communicate with
multiple destinations concurrently, TCP must
handle a variety of delays that can change
rapidly.
40Solving the Retransmission Problem
- Keep estimate of round trip time on each
connection - Use current estimate to set retransmission timer
- Known as adaptive retransmission
- Key to TCPs success
41Adaptive Retransmission
- Timeout depends on current round-trip estimate
42Round-Trip Time Measurements
- The retransmission mechanism of TCP is adaptive
- The retransmission timers are set based on
round-trip time (RTT) measurements that TCP
performs
- The RTT is based on time difference between
segment transmission and receipt of ACK - But
- TCP does not ACK each segment
- Each connection has only one timer
43Round-Trip Time Measurements
- Retransmission timer is set to a Retransmission
Timeout (RTO) value - RTO is calculated based on the RTT measurements
- The RTT measurements are smoothed by the
following estimators srtt and rttvar - srtt_n1 a RTT (1-a)srtt_n
- rttvar_n1 b( RTT - srtt_n1 )
(1-b)rttvar_n - RTO_n1 srtt_n1 4rttvar_n1
- Typical values a 1/4 and b 1/8
44Karn's Algorithm (used in most current TCP
implementations)
- If an ACK for a retransmitted segment is
received, the sender cannot tell if the ACK
belongs to the original or the retransmission.
- Karn' Algorithm
- Don't update srtt on any segments that have been
retransmitted. - Each time when TCP retransmits, it sets
- RTO_n1 max ( 2RTO_n, 64) (exponential backoff)
45RTO Calculation Example
- t1 RTO srtt 2rttvar 6 sec
- t2 RTO 2 (srtt 4rttvar) 24 sec
(exponential backoff) - t4 RTO is not updated (Due to Karn's algorithm)