Pakravan573 27333 PDF
Pakravan573 27333 PDF
Pakravan573 27333 PDF
Transport Layer
M. R. Pakravan
Department of Electrical Engineering
Sharif University of Technology
Data Networks 1
Transport Layer
Tasks:
Provide reliable and cost effective end-to-end communication service to the
application layer
Independent of used network (shielding)
Boundary between network and applications
TPDU (transport protocol data unit) denotes message sent from entity to entity
Can be both connection oriented and connectionless service
Data Networks 2
Transport Service
Transport Service and Data Link Services:
Similarities:
Both provide point-to-point connection
Both have to deal with error control, sequencing, flow control, retransmission, etc.
Differences:
Transport connection is indirect
Network has memory: packets may be stored and and arrive with varying delays
and out of order
Many connections
have to be managed
(instead of a fixed
number of links)
Data Networks 3
Transport Service
Primitives for a simple transport service:
LISTEN: block until some process connects
CONNECT
SEND
RECEIVE: block until data TPDU arrives
DISCONNECT
Data Networks 4
Elements of transport protocols
Addressing: TSAP (transport TCP addressing:
service access point); (IP address, port number)
How do I know the TSAP of the Example ports of well knows services:
destination? port 7: Echo
Using well known addresses (works port 23: Telnet
only for (stable) key services)
port 25: SMTP (email)
Use name server (or directory port 80: HTTP (www)
server)
port 110: POP (reading remote email)
Connect to this server
Send message and ask for TSAP
address of needed server
Set up a connection with needed
server.
New services have to register
with name server
Data Networks 5
TCP Provides a logical full duplex connection between two application layer
processes across an unreliable datagram network (IP network)
TCP Provides flow control using Selective Repeat
TCP Can support multiple connections at the same time
Each direction of the connection can be terminated independently
TCP Service is:
Connection oriented
Reliable Application Application
In-sequence
byte stream byte stream
Byte stream
segments
Transmitter Receiver
Send buffer Receive buffer
Data Networks 7
Data Networks 8
TCP Congestion Control
TCP controls the data flow between two endpoints of a connection
Selective repeat sliding window is used for flow control
Receiver specifies its reception capacity called “Advertised Window”
(WA) in the header of the messages that it sends back to transmitter.
This handles the end-to-end flow control
Network congestion can also be controlled by slowing down the flow
of data that TCP generates into the network. This requires feedback
from the network behavior.
The maximum amount of bytes that a TCP sender can transmit
without congesting the network is called “Congestion Window” (WC)
TCP works by adapting these two windows to control the traffic
generation process.
Data Networks 9
TCP Operation
Transmitter Receiver
Send Window
Receive Window
Slast+Wa-1 Rlast Rlast+WR-1
Data Networks 10
TCP Operation
Rnew can be greater than Rnext because the receiver accepts out of
sequence bytes
Receiver buffer has a size of WR
Rlast+WR-1 is the maximum numbered byte the receiver can
accept
Advertised window: capacity of buffer available at the receiver:
WA=WR-(Rnew-Rlast)
Transmitter should make sure that the number of outstanding
bytes is less than the advertised window size:
Srecent-Slast≤WA
TCP separates acknowledgment from flow control.
Advertised window is used to effectively control the traffic flow. It is
contained in the header of the frames going back to the sender.
Data Networks 11
TCP Operation
String of bytes from application layer are grouped together to form a
“segment”
A 32 bit sequence number is assigned to each byte of the segment.
Initial seq# in each direction is chosen randomly and negotiated.
Timer management:
Round trip delay of each segment (Transmission to ack) is measured.
Appropriate time is chosen based on history and variation of this delay
Typical moving average parameters: =7/8 and =1/4
Data Networks 12
Congestion Control in TCP
Sender can transmit up to the minimum of “Advertised Window” (WA) and
“Congestion Window” (WC). This is called Current Window
TCP transmitter controls WC dynamically. Steps are:
Slow Start: At the start, WC =1
After each successful ACK from receiver, WC = WC *2
Congestion Avoidance: If WC =congestion threshold (66,535 bytes), increase WC
linearly with each successful ACK.
Congestion Reaction: When there
is congestion (Time out on ACK)
set congestion threshold to the be
WCU/2 and set WC =1
Assumption is that ACK loss is due
to congestion.
This is valid for wired networks, but
not for wireless networks where PHY
is not as reliable.
Data Networks 13
TCP Frame
Source Port, Destination Port:
<IP+TCP Port> uniquely identifies a process on each end.
Seq_no : Position of the first byte of this segment in the sender’s
byte stream (Can be different in each direction)
ACK_no : Sequence number of the next data byte that the sender
expects to receive if the ACK bit is set
Window Size: The number of bytes the receiver is willing to accept
Urgent Pointer: The value of this field added to that in the Seq No.
Field points to the last byte of URGENT DATA that needs
immediate delivery
Data Offset:
Length of TCP header
Data Networks 14
TCP Frame
PSH: if set to 1, receiver should pass the data to application
immediately without buffering
ACK: ACK # is valid if ACK=1
URG: Urgent # is valid if URG=1
RST: if set to 1, reset connection
FIN: If set to one, the sender has no more byte to send (Can still
receive). Connection is terminated if the other end sends a FIN
SYN: Indicate a connection request or connection acknowledge
during the startup procedure
Connection Request:
[SYN,ACK]=[1,0]
Connectione Accepted:
[SYN,ACK]=[1,1]
Data Networks 15
TCP Checksum
0 8 16 31
Source IP Address
Destination IP Address
Data Networks 16
TCP Connection Setup
Host B is waiting for incoming
connection
Host A: Sends a request,
SYN=1, Seq_no=x
Host B: Replies by setting
ACK=1, ACK_no=1+x, SYN=1,
Seq_no=y
Host A: Acknowledges by
setting the ACK=1,
ACK_no=1+y, Seq_no=1+x
If during a connection
establishment phase, one of
the hosts decides to refuse a
connection, it will send a
RESET segment by setting the
RST bit.
Data Networks 17
Data Networks 18
Real Time Transport Protocol (RTP)
A generic protocol for real time applications such as voice and video
Uses UDP and acts as an interface between user application and transport
protocol (Mostly UDP)
Header specifies the profile and encoding format of the payload (single
audio stream, mp3)
Packets are numbered to allow detection of missing packets
Time stamping is used to allow synchronization and jitter compensation
No flow control, no error control, no acknowledgement and no repeat-
requests
Services:
Payload type identification
Sequence numbering
Time stamping
Delivery monitoring
Data Networks 19
P bit: the packet has been padded to a multiple of 4-bytes. The last padding
byte tells how many bytes were padded
X bit: an extension header is present
CC field: How many contributing sources of data are present
M bit: Marker bit used by the application
Time stamp of the first sample of the payload content is noted in the header:
Appropriate time alignment of the samples in the receiver for smooth playback
and jitter reduction
Synchronization between multiple streams such as video and audio in a
videoconference
Synch Source ID: Tells which
stream this packet belongs to.
Data Networks 20
Real Time Transport Control Protocol
Data Networks 21