Module 6
Introduction to Transport Layer
McGraw-Hill © The McGraw-Hill Companies, Inc., 2000
Transport-Layer Services
• Transport layer is located between the network
layer and the application layer.
• The transport layer is responsible for providing
services to the application layer; it receives
services from the network layer.
• The transport layer is responsible for process-to-
process delivery—the delivery of a packet, part
of a message, from one process to another.
• Two processes communicate in a client/server
relationship.
Types of data deliveries
23.3
Addressing: Port Numbers
• A process on the local host, called a client, needs services from a
process usually on the remote host, called a server.
• However, operating systems today support both multiuser and
multiprogramming environments.
• A remote computer can run several server programs at the same
time, just as several local computers can run one or more client
programs at the same time.
• For communication, we must define the local host, local process,
remote host, and remote process.
• The local host and the remote host are defined using IP addresses.
• To define the processes, we need second identifiers, called port
numbers. In the TCP/IP protocol suite, the port numbers are integers
between 0 and 65,535 (16 bits).
Addressing: Port Numbers
• The client program defines itself with a port
number, called the ephemeral port number.
• The word ephemeral means “short-lived” and
is used because the life of a client is normally
short.
• TCP/IP has decided to use universal port
numbers for servers; these are called well-
known port numbers
ICANN Ranges
Port numbers
23.7
IP addresses versus port numbers
23.8
Socket Address
• A transport-layer protocol in the TCP suite needs
both the IP address and the port number, at each
end, to make a connection. The combination of an
IP address and a port number is called a socket
address.
• The client socket address defines the client process
uniquely just as the server socket address defines
the server process uniquely.
Encapsulation and Decapsulation
Multiplexing and Demultiplexing
• Whenever an entity accepts items from more
than one source, this is referred to as
multiplexing (many to one); whenever an
entity delivers items to more than one
source, this is referred to as demultiplexing
(one to many).
• The transport layer at the source performs
multiplexing; the transport layer at the
destination performs demultiplexing
Multiplexing and Demultiplexing
Flow Control
• Delivery of items from a producer to a consumer
can occur in one of two ways: pushing or pulling.
• If the sender delivers items whenever they are
produced⎯without a prior request from the
consumer⎯the delivery is referred to as pushing.
• If the producer delivers the items after the
consumer has requested them, the delivery is
referred to as pulling.
Pushing or Pulling
Buffers
• A buffer is a set of memory locations that can hold packets
at the sender and receiver.
• The flow control communication can occur by sending
signals from the consumer to the producer.
• When the buffer of the sending transport layer is full, it
informs the application layer to stop passing chunks of
messages; when there are some vacancies, it informs the
application layer that it can pass message chunks again.
• When the buffer of the receiving transport layer is full, it
informs the sending transport layer to stop sending
packets. When there are some vacancies, it informs the
sending transport layer that it can send packets again.
Error Control
• Error control requires that the sending
transport layer knows which packet is to be
resent and the receiving transport layer
knows which packet is a duplicate, or which
packet has arrived out of order.
• This can be done if the packets are
numbered. We can add a field to the
transport-layer packet to hold the sequence
number of the packet.
Connectionless and Connection-
Oriented Protocols
• Connectionless service at the transport layer
means independency between packets;
connection-oriented means dependency
Connectionless Service
Connection-Oriented Service
Transport-Layer Protocols
Services
• UDP
• UDP is an unreliable connectionless transport-layer
protocol used for its simplicity and efficiency in
applications where error control can be provided by the
application-layer process.
• TCP
• TCP is a reliable connection-oriented protocol that can be
used in any application where reliability is important.
• SCTP
• SCTP is a new transport-layer protocol that combines the
features of UDP and TCP.
Port Numbers
USER DATAGRAM PROTOCOL(UDP)
• connectionless, unreliable transport protocol.
• providing process-to-process communication
instead of host-to-host communication
• If UDP is so powerless, why would a process
want to use it?
• “If a process wants to send a small message
and does not care much about reliability, it
can use UDP. Sending a small message using
UDP takes much less interaction between the
sender and receiver than using TCP.”
User datagram packet format
Example
Solution
UDP Services
1. Process-to-Process Communication
– using socket addresses, a combination of IP
addresses and port numbers.
2. Connectionless Services
– Each user datagram sent by UDP is an
independent datagram.
– There is no relationship between the different
user datagrams even if they are coming from the
same source process and going to the same
destination program.
UDP Services
3. Flow Control
– no flow control. the process using UDP should provide
for this service, if needed
4. Error Control
– no error control. the process using UDP should provide
for this service, if needed
5. Checksum
– UDP checksum calculation includes three sections: a
pseudoheader, the UDP header, and the data coming
from the application layer. The pseudoheader is the
part of the header of the IP packet
Pseudoheader for checksum
calculation
UDP Services
6. Congestion Control
– does not provide congestion control.
7. Encapsulation and Decapsulation
8. Multiplexing and Demultiplexing
UDP Applications
• The connectionless service provides less
delay; the connection-oriented service
creates more delay. If delay is an important
issue for the application, the connectionless
service is preferred.
• A client-server application such as DNS uses
the services of UDP because a client needs to
send a short request to a server and to
receive a quick response from it.
UDP Applications
• A client-server application such as SMTP,
which is used in electronic mail, cannot use
the services of UDP because a user might
send a long e-mail message, which could
include multimedia (images, audio, or video).
Examples
1. Downloading a very large text file from the
Internet? – can’t use UDP
2. Real-time interactive application, such as
Skype? – can use UDP
3. route updating protocols such as Routing
Information Protocol(RIP) – can use UDP
TRANSMISSION CONTROL PROTOCOL(TCP)
• connection-oriented, reliable protocol.
• TCP explicitly defines connection establishment,
data transfer, and connection teardown phases to
provide a connection-oriented service.
• TCP uses a combination of GBN and SR protocols to
provide reliability.
• To achieve this goal, TCP uses checksum (for error
detection), retransmission of lost or corrupted
packets, cumulative and selective
acknowledgments, and timers.
TCP Services
• Process-to-Process Communication
– As with UDP, TCP provides process-to-process
communication using port numbers
• Stream Delivery Service
– allows the sending process to deliver data as a
stream of bytes and allows the receiving process
to obtain data as a stream of bytes
• Sending and Receiving Buffers
– Because the sending and the receiving processes
may not necessarily write or read data at the
same rate, TCP needs buffers for storage. There
are two buffers, the sending buffer and the
receiving buffer, one for each direction
• Full-Duplex Communication
– TCP offers full-duplex service, where data can
flow in both directions at the same time.
• Multiplexing and Demultiplexing
– Like UDP, TCP performs multiplexing at the sender and
demultiplexing at the receiver.
• Connection-Oriented Service
– TCP, unlike UDP, is a connection-oriented protocol. When
a process at site A wants to send to and receive data
from another process at site B, the following three
phases occur:
1. The two TCP’s establish a logical connection between
them.
2. Data are exchanged in both directions.
3. The connection is terminated.
• Reliable Service
– TCP is a reliable transport protocol. It uses an
acknowledgment mechanism to check the safe
and sound arrival of data.
Stream delivery
23.39
Sending and receiving buffers
23.40
Segment
• At the transport layer, TCP groups a number
of bytes together into a packet called a
segment.
• TCP adds a header to each segment (for
control purposes) and delivers the segment
to the network layer for transmission.
• The segments are encapsulated in an IP
datagram and transmitted.
TCP segments
23.42
Numbering System
• Byte Number
• TCP numbers all data bytes (octets) that are transmitted in
a connection. Numbering is independent in each direction.
When TCP receives bytes of data from a process, TCP
stores them in the sending buffer and numbers them.
• The numbering does not necessarily start from 0. Instead,
TCP chooses an arbitrary number between 0 and 232 − 1
for the number of the first byte.
• For example, if the number happens to be 1057 and the
total data to be sent is 6000 bytes, the bytes are
numbered from 1057 to 7056.
Numbering System
• Sequence Number
• After the bytes have been numbered, TCP assigns a
sequence number to each segment that is being
sent. The sequence number, in each direction, is
defined as follows:
1. The sequence number of the first segment is the
ISN (initial sequence number),which is a random
number.
2. The sequence number of any other segment is the
sequence number of the previous segment plus the
number of bytes (real or imaginary) carried by the
previous segment.
Note
The bytes of data being transferred in each
connection are numbered by TCP.
The numbering starts with a randomly
generated number.
23.45
Example
The following shows the sequence number for each
segment:
23.46
Note
The value in the sequence number field of a
segment defines the
number of the first data byte
contained in that segment.
23.47
Note
The value of the acknowledgment field in a segment
defines
the number of the next byte a party expects to
receive.
23.48
TCP segment format
23.49
Control field
23.50
Description of flags in the control field
23.51
A TCP Connection
• In TCP, connection-oriented transmission
requires three phases:
– connection establishment
– data transfer, and
– connection termination.
Connection Establishment
• The connection establishment in TCP is called
three-way handshaking. In our example, an
application program, called the client, wants
to make a connection with another
application program, called the server, using
TCP as the transport-layer protocol.
Connection establishment using three-way handshaking
23.54
Note
A SYN segment cannot carry data, but it
consumes one sequence number.
23.55
Note
A SYN + ACK segment cannot
carry data, but does consume one
sequence number.
23.56
Note
An ACK segment, if carrying no data,
consumes no sequence number.
23.57
Data transfer
23.58
Connection termination using three-way handshaking
23.59
Note
The FIN segment consumes one sequence
number if it does
not carry data.
23.60
Note
The FIN + ACK segment consumes
one sequence number if it
does not carry data.
23.61
Half-close
23.62
TCP Congestion Control
• There should be no end congestion(at receiver
side) or middle congestion(in the middle of
transmission).
• The end congestion can be informed to sender by
using the value of rwnd which is advertised in
each segment travelling in the opposite direction.
• To control the number of segments to transmit,
TCP uses another variable called a congestion
window, cwnd, whose size is controlled by the
congestion situation in the network
TCP Congestion Control
• In the slow-start algorithm, the size of the
congestion window increases exponentially
(1,2,4,8…..) until it reaches a threshold.
• Once the cwnd size reaches to thresold, we
need to use congestion-avoidance algorithm.
• In the congestion-avoidance algorithm, the
size of the congestion window increases
additively until congestion is detected.
SCTP
• Stream Control Transmission Protocol (SCTP) is a
new reliable, message-oriented transport layer
protocol. SCTP, however, is mostly designed for
Internet applications that have recently been
introduced.
• These new applications need a more sophisticated
service than TCP can provide.
23.65
Note
SCTP is a message-oriented, reliable protocol
that combines the best features of UDP and
TCP.
23.66
Multiple-stream concept
23.67
Note
An association in SCTP can involve multiple streams.
23.68
Multihoming concept
23.69
Note
SCTP association allows multiple IP addresses
for each end.
23.70