Chapter 3 Transport Layer Principles
Chapter 3 Transport Layer Principles
TRANSPORT LAYER
PRINCIPLES
FRU NGANG
SUPP’TIC
PLAN
1. Design Issues
2. User Datagram Protocol
(UDP)
3. Transmission Control
Protocol (TCP)
4. New(er) transport
protocols
1. SCTP
2. DCCP
4.1 Design Issues
• Characteristics of the layers below the transport layer
• Available on the hosts and on the routers
• Operate in a hop to hop fashion
• Typically unreliable
• Characteristic of the Transport Layer
• Available only on the hosts
• Operate in an end-to-end fashion
• It has to operate like a pipe
• Services Provided to the upper layers
• Connection oriented service
• Connectionless service
• Convenient interface for application programmers (sockets)
• sockets
4.1 Design Issues
• Services Provided to the upper layers
• Goal is to provide an efficient, reliable, and cost effective service
• Transport Entity is responsible to provide that service
• May be located in the OS kernel, user process, library package or NIC
4.1.1 Transport service Primitives
Some terminology
Messages from Transport Layer entities are
known as Transport Protocol Data Unit (TPDU).
TPDU are contained in contained in network layer
Packets.
Packets are contained in in data link layer frames.
4.1.1 Transport service Primitives
• Processes on the application layer expect 100% reliable
connections
• They are not interested in acknowledgements, lost packets,
congestion, …
• Transport layer provides
• Unreliable datagram services ( connectionless)
• Reliable connection-oriented services
PRIMITIV PACKET SENT MEANING
• Three phases: establishment, communication, termination
E
• The primitives for a simple connection-oriented transport
LISTEN (none) Block until some process tries to
service connect
CONNECT CONNECTION REQ Actively attempt to establish a
connection
4.1.1 Transport service Primitives
4.1.1 Transport service Primitives
A state diagram for a simple connection management
scheme
• Transitions labelled in italics are caused by packet arrivals
• The solid lines show the client’s state sequence
• The dashed lines show the server’s state sequence
4.1.2 Transport protocol
Transport Protocol
• Transport services are implemented between transport entities by a transport
protocol
• Similar to Data Link Layer Protocols, Transport layer protocols have to deal with error
control, sequencing and flow control.
• On DLL, two routers communicate by using a physical channel
• No explicit addressing is required,
• Channel is always there
• On TL, channel is provided by the network layer
• Explicit addressing of the destination is required
• Channel is not always there
• Connection establishment is complicated
4.1.2 Transport protocol: addressing
• Addressing on the Transport Layer
• To which process connect to?
• Transport Service Access Point (TSAP)
• Network Service Access Point (NSAP)
• Question
• How does the process on Host 1 know the TSAP
of server 1 on Host 2?
• Solution
• TSAPS are stored in specific files
• Unix: /etc/services
• Window: \system32\drivers\etc\services
4.1.2 Transport protocol: addressing
• Addressing on the Transport Layer
• To which process connect to?
• Transport Service Access Point (TSAP)
• Network Service Access Point (NSAP)
• Question
• How does the process on Host 1 know the TSAP
of server 1 on Host 2?
• Solution
• TSAPS are stored in specific files
• Unix: /etc/services
• Window: \system32\drivers\etc\services
4.1.2 Transport protocol: addressing
• Disadvantage of the previous solution
• For small number of servers the solution with specific files
works fine.
• Problem
• What happens when there are many servers which are
rarely used.
• Solution
• Special process: Process Server
• Listens to a set of TSAPs
• When desired server is not active, Connection is made with the
process server
• Process server starts the server for the desired service and passes
the connection to it.
4.1.2 Transport protocol: addressing
• Disadvantage of the previous solution
• What happens if the server can not be started, ie
service depends on the process
• Solution
• Special process: Name Server / Directory Server
• Listens to a set of TSAPs
• When the desired server is not active, connection is
made with the process server
• Process server starts the server for the desired
service and passes the connection to it.
• Requirement
• Servers have to register with the name server
• Records of ( Name, TSAP)
4.1.2 Transport protocol: connection
•
establishment
Problems with connection establishment
• When network can lose, store, and duplicate packets
• Delayed duplicates
• Solution approaches
• Throw away TSAPs: For each connection, a new TSAP is used.
• Management of used TSAP
• Restrict packet life time, e.g by a TTL field, timestamp …
• The Three way handshake (Tomlinson, Sunshine and Dalal)
• Each computer has a clock, time of the day
• Clocks do not need to be synchronized
• Clock has to run even if when the computer crashes or is switched off
• Idea: Put sequence numbers into TPDU and two TPDUs with the same sequence number may not outstand in the same time
• Each connection starts with a different initial sequence number.
4.1.2 Transport protocol: connection establishment
Connection establishment with the three way handshake
• Three protocol scenarios for establishing a connection using a three-way handshake. CR
denotes CONNECTION REQUEST
a)Normal operation
b)Old CONNECTION REQUEST appearing out of nowhere
c)Duplicate CONNECTION REQUEST and duplicate ACK
4.1.2 Transport protocol: connection release
• Terminating a connection
●Asymmetric release
• Telephone system model
• Either one peer can terminate the connection
• Danger of data loss
●Symmetric release
• Model of two independent unicast connections
• Each peer has to terminate the connection explicitly
• Data can be received by in the non-terminated direction
• Problem: Data loss can happen on both cases
• Question: Is there an optimal solution?
4.1.2 Transport protocol: connection release
• Famous example to illustrate the problem of controlled (reliable) connection
termination: The two-army problem
• The Blue armies can only communicate with messengers, i.e., soldiers running
through the valley
• Messengers are subject to loss
Messengers
Of the
Blue Army
4.1.2 Transport protocol: connection release
Four protocol scenarios for releasing a connection
a. Normal case of a three-way handshake
b. final ACK lost
4.1.2 Transport protocol: connection release
Four protocol scenarios for releasing a connection
c)Response lost
d)Response lost and subsequent DRs lost
4.1.2 Transport protocol: connection release
Four protocol scenarios for releasing a connection
c)Response lost
d)Response lost and subsequent DRs lost
4.1.2 Transport protocol: Multiplexing
Multiplexing of several conversations onto connections
a) Upward multiplexing: Many transport connections use the same network address
b) Downward multiplexing: Distribute the traffic of one connection over many network connections
4.1.2 Transport protocol: Multiplexing
4.1.2 Transport protocol: Crash Recovery
4.1.2 Transport protocol: Crash Recovery
4.2 Transport protocols in the TCP/IP model
4.2.1 The Classical Transport layer protocols
TCP & UDP
• Transport protocols are used by the application layer as communication services
• They allow the communication between application processes
• TCP is a connection-oriented protocol
• UDP is a connectionless
4.2.2 UDP
• Principle: “Keep it simple!”
• 8 byte header
• Like IP: connectionless and unreliable
• Small reliability, but fast exchange of information
• No acknowledgement between communication peers with UDP
• Incorrect packets are simply discarded
• Duplication, sequence order permutation, and packet loss are possible
• The checksum offers the only possibility of testing the packets on transfer errors
• Possible: ACKs and retransmissions are controlled by the application
• Use in multicast (not possible with TCP)
• Why at all UDP?
• Only the addition of a port to a network address makes communication unique
(IP Address1, Port1, IP Address2, Port2)
4.2.2 UDP Header
• Source Port, Destination Port: Addressing of the applications by port numbers
• Length: The total length of the datagram (header + data) in 32-bit words
• Checksum (optional): IP does not have a checksum for the data part, therefore it can be a meaningful
addition here
• The same procedure as in TCP
• Data: The payload, it is filled up if necessary to an even byte number, since message length counts in 32-bit
words
4.2.2 UDP Header
• Source Port, Destination Port: Addressing of the applications by port numbers
• Length: The total length of the datagram (header + data) in 32-bit words
• Checksum (optional): IP does not have a checksum for the data part, therefore it can be a meaningful
addition here
• The same procedure as in TCP
• Data: The payload, it is filled up if necessary to an even byte number, since message length counts in 32-bit
words
4.2.2 UDP Header
• Byte stream, not message stream, i.e., message boundaries are not preserved
• Limited QoS
• Port numbers below 1024 are called well-known ports, these are reserved for standard services
4.2.3 TCP as a reliable connection
• If the server port is unknown, the use of a process server (Initial Connection
Protocol) is possible:
• Alternatively: Name server (comparable to a phone book) returns the destination port
4.2.3 TCP as a reliable connection
Establishes logical connections between two Sockets
IP address + 16 bit port number (48 bit address information)
(IP Address1, Port1, IP Address2, Port2)
For an application, sockets are the access points to the network
A socket can be used for several connections at the same time
TCP connections are always full-duplex and point-to-point
connections
TPDUs exchanged between the two communicating stations are
called segments
Segments are being exchanged for realizing
Connection establishment
Agreement on a window size
Data transmission
Sending of confirmations
Connection termination
4.3.2TCP: Overview R FCs: 793, 1122, 1323, 2018, 2581
size connection-oriented:
send & receive buffers handshaking (exchange of control msgs)
init’s sender, receiver state before data
exchange
application application
flow controlled:
w rites data reads data
sock et
door
sock et
door
sender will not overwhelm receiver
TCP TCP
send buffer receive buffer
se g m e n t
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
UA P R S F Receive window
(generally not used) # bytes
checksum Urg data pnter
rcvr willing
R ST, SYN , FIN: to accept
Options (variable length)
connection estab
(setup, teardown
commands)
application
Internet data
checksum (variable length)
(as in UDP)
TCP segment structure
●Source and Destination Port: port number of sender resp. receiver
●Sequence Number/Acknowledgment Number: Segments have a 32 bit sequence and
acknowledgement number for the window mechanism in flow control (Sliding
Window).
●Sequence and acknowledgement number count single bytes!
●The acknowledgement number indicates the next expected byte!
●Sequence numbers begin not necessarily with 0! A random value is chosen to avoid a
possible mix-up of old (late) segments.
●Piggybacking, i.e., an acknowledgement can be sent in a data segment.
●Header Length: As in case of IP, also the TCP header has an indication of its length.
The length is counted in 32-bit words.
●Window Size: Size of the receiver’s buffer for the connection.
●Used in flow control: the window of a flow indicates, how many bytes at the same time can
be sent.
●The size of the buffer indicates, the number of bytes the receiver can accept.
●The window of flow control is adapted to this value.
TCP segment structure
●Flags:
●URG: Signaling of special important data, e.g., abort, Ctrl-C
●ACK: This bit is set, if an acknowledgement is sent
●PSH: Immediate transmission of data, no more waiting for further data
●RST: Reset a connection, e.g., during a host crash or a connecting
rejection
●Generally problems arise when a segment with set RST bit is received
●SYN: set to 1 for connection establishment
●FIN: set to 1 for connection termination
●Urgent pointer: indicates, at which position in the data field the urgent data
ends (byte offset of the current sequence number).
●Option:
●Negotiation of a window scale: Window size field can be shifted up to 14
bits allowing windows of up to 230 bytes
●Use of Selective Repeat instead of Go-Back-N in the event of an error
●Indication of the Maximum Segment Size (MSS) to determine the size of
4.3.3 Connection management: connection establishment
The server waits for connection requests using
LISTEN and ACCEPT.
The client uses the CONNECT operation by
indicating IP address, port number, and the
acceptable maximum segment size (MSS).
CONNECT sends a SYN.
If the destination port of the CONNECT is
identical to the port number on which the server
waits, the connection is accepted, otherwise it is
rejected with RST.
The server also sends a SYN to the client and
acknowledges at the same time the receipt of
the client’s SYN segment.
The client sends an acknowledgement for the
SYN segment of the server. The connection is
established.
4.3.3 Connection management: irregular connection establishment
Full-duplex connection
Segmentation of a byte stream into
segments.
Usual sizes are 1500, 536, or 512 byte; thus IP
fragmentation is avoided.
All hosts have to accept TCP segments of 536
byte +20 byte = 556 byte
Usual acknowledgement mechanism:
All segments up to ACK-1 are confirmed. If
the sender has a timeout before an ACK, he
repeats the sending.
Usual procedure for repeating:
Go-Back-N or Selective Repeat
4.3.3 TCP Connection management:Connection Termination
Keep-alive timer
If a connection is inactive for a longer time, at expiration of the timer it is
examined whether the other side is still living.
If no response is given, the connection is terminated.
Disputed function, not often implemented.
Keep-alive timer
If a connection is inactive for a longer time, at expiration of the timer it is
examined whether the other side is still living.
If no response is given, the connection is terminated.
Disputed function, not often implemented.
Seq=9 Seq=9
2, 8 b 2, 8 b
ytes d ytes d
a ta Seq= a ta
100,
Seq=92 timeout
20 by
t es d
at a
00
timeout
=1
ACK 0
10
X CK
A AC
=
K =12 0
loss
Seq=9 Seq=9
2, 8 b 2, 8 b
ytes d Sendbase ytes d
a ta
a ta = 100
Seq=92 timeout
SendBase
= 120 =1 20
K
CK =100 AC
A
SendBase
= 100 SendBase
= 120 premature timeout
time time
lost ACK scenario
Transport Layer 3-51
4.3.5 TCP retransmission scenarios (more)
Host A Host B
Seq=9
2, 8 b
ytes d
a ta
Seq=1 CK = 10 0
timeout 00 , 20 A
bytes
da t a
X
loss
SendBase CK =120
A
= 120
time
Cumulative ACK scenario
Arrival of in-order segment with expected seq #. All data Delayed ACK. Wait up to 500ms
up to expected seq # already ACKed for next segment. If no next segment, send ACK
Arrival of in-order segment with expected seq #. One other Immediately send single cumulative
segment has ACK pending ACK, ACKing both in-order segments
Arrival of segment that partially or completely fills gap Immediately send ACK, provided that
segment starts at lower end of gap
Congestion:
Informally: “too many sources sending too much data too fast for
network to handle”
Different from flow control!
Manifestations:
• Lost packets (buffer overflow at routers)
• Long delays (queueing in router buffers)
A top-10 problem!
Slow Start is not well suited when only a single packet is lost…
Time-out period often relatively long Long delay before resending lost packet
E.g. short interference on a wireless link
Fast Retransmit
The receiver sends a duplicate ACK immediately when an out-of-
order segment arrives
When the sender has received 3 duplicate ACKs, it retransmits
the missing segment.
• Hopefully, the acknowledgement for the repeated segment
arrives before a timeout
Key features
Reliable,connection-oriented transport protocol, multi-streaming,
multi-homing, heartbeats, 4-way-handshake, TCP friendly, certain
resistance to flooding/masquerade attacks, message oriented
Checksum
Calculated over the whole SCTP packet including common
header (with checksum initialized to 0) and all chunks
Invalid packets are typically silently discarded
Connectionless service X
Ordered X X
Partially Ordered X
Unordered
Reliable X X
Partially Reliable X
Unreliable X X
Multicast support X X
Multihoming support X
Chapter 4: Transport Layer 4-75