The Transport Layer
Chapter 6
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Transport Service
• Upper Layer Services
• Transport Service Primitives
• Berkeley Sockets
• Example of Socket Programming:
Internet File Server
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Services Provided to the Upper Layers
The network, transport, and application layers
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Services Provided to the Upper Layers
• Qualitative distinction between layers 1 through 4 and layer(s)
above 4
• The bottom four layers can be seen as the transport service
provider, whereas the upper layer(s) are the transport service
user
• It forms the major boundary between the provider and user
of the reliable data transmission service
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Transport Service Primitives (1)
• To allow users to access the transport service, the transport layer must
provide some operations to application programs, that is, a transport
service interface
• Each transport service has its own interface
• The connection-oriented transport service, in contrast, is reliable. Of
course, real networks are not error-free, but that is precisely the purpose of
the transport layer—to provide a reliable service on top of an unreliable
network
• As an example, consider two processes on a single machine connected by
a pipe in UNIX (or any other interprocess communication facility). They
assume the connection between them is 100% perfect. They do not want
to know about acknowledgements, lost packets, congestion, or anything at
all like that.
• The connection-oriented transport service is all about—hiding the
imperfections of the network service so that user processes can just
assume the existence of an error-free bit stream even when they are on
different machines.
• The transport layer can also provide unreliable (datagram) service
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Transport Service Primitives (2)
• A second difference between the network service and transport service is
whom the services are intended for
• Very few users write their own transport entities, and thus few users or
programs ever see the bare network service. In contrast, many programs
(and thus programmers wiritng socket applications) see the transport
primitives
The primitives for a simple transport service
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Transport Service Primitives (3)
Nesting of TPDUs, packets, and frames.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Connection Establishment
A state diagram for a simple connection management scheme.
Transitions labeled 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.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Berkeley Sockets (2)
The socket primitives for TCP
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Transport Service Primitives (1)
• The first four primitives in the list are executed in that
order by servers.
• The SOCKET primitive creates a new endpoint and
allocates table space for it within the transport entity. The
parameters of the call specify the addressing format to be
used, the type of service desired (e.g., reliable byte
stream), and the protocol
• Newly created sockets are assigned network addresses
with BIND primitive
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Example of Socket Programming:
An Internet File Server (1)
... Client code using sockets
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Example of Socket Programming:
An Internet File Server (2)
...
...
Client code using sockets
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Example of Socket Programming:
An Internet File Server (3)
...
Client code using sockets
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Example of Socket Programming:
An Internet File Server (4)
...
Server code
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Example of Socket Programming:
An Internet File Server (5)
...
...
Server code
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Example of Socket Programming:
An Internet File Server (6)
...
Server code
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Elements of Transport Protocols (1)
• Addressing
• Connection establishment
• Connection release
• Error control and flow control
• Multiplexing
• Crash recovery
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Elements of Transport Protocols (2)
• The process of establishing a connection over the wire is
simple
• The potential existence of storage capacity in the network
• Buffering and flow control are needed in both layers, but the
presence of a large and varying number of connections with
fluctuating bandwidth as the connections compete with each
other may require a different approach than we used in the
data link layer.
a) Environment of the data link layer. (b) Environment of the transport layer.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Addressing (1)
TSAPs, NSAPs, and transport connections
How does the host 1 know that the mail server is attached to TSAP 1522?
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Addressing (2)
• How does the user process on host 1 know that the mail
server is attached to TSAP 1522?
• One possibility is to fix that service on that port
• Use Portmapper - The user sends a message specifying
the service name, and the portmapper sends back the
TSAP address
• Use ProcessServer - acts as a proxy for less heavily used
servers. It listens to a set of ports at the same time, then
spawn the requested server
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Addressing (3)
How a user process in host 1 establishes a connection
with a mail server in host 2 via a process server.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Connection Establishment (1)
• If network is fully congested, neither data
or ack are delivered, leading to multiple
retransmissions.
• If user crashes and start using the same
set of sequence used earlier, it might lead
to duplicate packet delivery problem
• Fund transfer example
• Solution can be –
1. discard the port numbers used before crash
2. Assign each connection unique number
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Connection Establishment (1)
Techniques for restricting packet lifetime
• Restricted network design.
• Putting a hop counter in each packet.
• Timestamping each packet.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Connection Establishment (2)
* Forbidden region shows the times for which segment seq numbers are illegal
* If any segment is sent with a sequence number in this region, it could be
delayed and impersonate a different packet with the same sequence number
that will be issued slightly later
a) TPDUs may not enter the forbidden region.
b) The resynchronization problem.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Connection Establishment (3)
Three protocol scenarios for establishing a connection using a
three-way handshake. CR denotes CONNECTION REQUEST.
Normal operation.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Connection Establishment (4)
Three protocol scenarios for establishing a connection using a
three-way handshake. CR denotes CONNECTION REQUEST. Old
duplicate CONNECTION REQUEST appearing out of nowhere.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Connection Establishment (5)
Three protocol scenarios for establishing a connection using a
three-way handshake. CR denotes CONNECTION REQUEST.
Duplicate CONNECTION REQUEST and duplicate ACK
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Connection Release (1)
Abrupt disconnection with loss of data
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Connection Release (2)
The two-army problem
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Connection Release (3)
Four protocol scenarios for releasing a connection.
(a) Normal case of three-way handshake
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Connection Release (4)
Four protocol scenarios for releasing a connection.
(b) Final ACK lost.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Connection Release (5)
Four protocol scenarios for releasing a connection.
(c) Response lost
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Connection Release (6)
Four protocol scenarios for releasing a connection.
(d) Response lost and subsequent DRs lost.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Error Control and Flow Control (2)
Dynamic buffer allocation. The arrows show the direction of
transmission. An ellipsis (...) indicates a lost TPDU
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Multiplexing
(a) Multiplexing. (b) Inverse multiplexing.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Congestion Control
• Desirable bandwidth allocation
• Regulating the sending rate
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Desirable Bandwidth Allocation (1)
(a) Goodput and (b) delay as a function of offered load
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Desirable Bandwidth Allocation (2)
Max-min bandwidth allocation for four flows
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Desirable Bandwidth Allocation (3)
Changing bandwidth allocation over time
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Regulating the Sending Rate (1)
A fast network feeding a low-capacity receiver
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Regulating the Sending Rate (2)
A slow network feeding a high-capacity receiver
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Regulating the Sending Rate (3)
Some congestion control protocols
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
User 2’s allocation
Regulating the Sending Rate (4)
User 1’s allocation
Additive Increase Multiplicative Decrease (AIMD) control law.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The Internet Transport Protocols: UDP
• Introduction to UDP
• Remote Procedure Call
• Real-Time Transport
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Introduction to UDP (1)
The UDP header.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Introduction to UDP (2)
The IPv4 pseudoheader included in the UDP checksum.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Remote Procedure Call
Steps in making a remote procedure call. The stubs are shaded.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Real-Time Transport (1)
(a) The position of RTP in the protocol stack. (b) Packet nesting.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Real-Time Transport (2)
The RTP header
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Real-Time Transport (3)
Smoothing the output stream by buffering packets
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Real-Time Transport (3)
High jitter
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Real-Time Transport (4)
Low jitter
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The Internet Transport Protocols: TCP (1)
• Introduction to TCP
• The TCP service model
• The TCP protocol
• The TCP segment header
• TCP connection establishment
• TCP connection release
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The Internet Transport Protocols: TCP (2)
• TCP connection management modeling
• TCP sliding window
• TCP timer management
• TCP congestion control
• TCP futures
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The TCP Service Model (1)
Some assigned ports
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The TCP Service Model (2)
a) Four 512-byte segments sent as separate IP diagrams
b) The 2048 bytes of data delivered to the application in a
single READ call
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The TCP Segment Header
The TCP header.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
TCP Connection Establishment
a) TCP connection establishment in the normal case.
b) Simultaneous connection establishment on both sides.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
TCP Connection Management Modeling (1)
The states used in the TCP connection
management finite state machine.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
TCP Connection Management Modeling (2)
TCP connection management
finite state machine.
The heavy solid line is the
normal path for a client. The
heavy dashed line is the
normal path for a server. The
light lines are unusual events.
Each transition is labeled by
the event causing it and the
action resulting from it,
separated by a slash.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
TCP Sliding Window (1)
Window management in TCP
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
TCP Sliding Window (2)
Silly window syndrome
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
TCP Timer Management
a) Probability density of acknowledgment arrival times in data
link layer. (b) … for TCP
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
TCP Congestion Control (1)
Slow start from an initial congestion window of 1 segment
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
TCP Congestion Control (2)
Additive increase from an initial congestion
window of 1 segment.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
TCP Congestion Control (3)
Slow start followed by additive increase in TCP Tahoe.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
TCP Congestion Control (4)
Fast recovery and the sawtooth pattern of TCP Reno.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Performance Issues
• Performance problems in computer networks
• Network performance measurement
• System design for better performance
• Fast TPDU processing
• Protocols for high-speed networks
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Performance Problems in Computer
Networks
The state of transmitting one megabit from San Diego to Boston.
(a) At t = 0. (b) After 500 μ sec.
(c) After 20 msec. (d) After 40 msec.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Network Performance Measurement (1)
Steps to performance improvement
a) Measure relevant network parameters,
performance.
b) Try to understand what is going on.
c) Change one parameter.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Network Performance Measurement (2)
Issues in measuring performance
• Sufficient sample size
• Representative samples
• Clock accuracy
• Measuring typical representative load
• Beware of caching
• Understand what you are measuring
• Extrapolate with care
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Network Performance Measurement (3)
Response as a function of load.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
System Design for Better Performance (1)
Rules of thumb
a) CPU speed more important than network speed
b) Reduce packet count to reduce software overhead
c) Minimize data touching
d) Minimize context switches
e) Minimize copying
f) You can buy more bandwidth but not lower delay
g) Avoiding congestion is better than recovering from it
h) Avoid timeouts
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
System Design for Better Performance (2)
Four context switches to handle one packet
with a user-space network manager.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Fast TPDU Processing (1)
The fast path from sender to receiver is shown with a heavy
line. The processing steps on this path are shaded.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Fast TPDU Processing (2)
(a) TCP header. (b) IP header. In both cases, the shaded fields
are taken from the prototype without change.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Protocols for High-Speed Networks (1)
A timing wheel
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Protocols for High-Speed Networks (2)
Time to transfer and acknowledge a
1-megabit file over a 4000-km line
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
Delay Tolerant Networking
• DTN Architecture
• The Bundle Protocol
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
DTN Architecture (1)
Delay-tolerant networking architecture
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
DTN Architecture (2)
Use of a DTN in space.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The Bundle Protocol (1)
Delay-tolerant networking protocol stack.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
The Bundle Protocol (2)
Bundle protocol message format.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011
End
Chapter 6
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011