Transport Layer and
Services
Transport layer Services
Process-to-Process Communication
Addressing: Port Numbers
Encapsulation and Decapsulation
Multiplexing and Demultiplexing
Flow Control
Error Control
Congestion Control
Connectionless and Connection-Oriented Services
Network layer versus transport layer
TCP/IP Protocol Suite 3
ICANN (The Internet Corporation for Assigned Names and Numbers) ranges
TCP/IP Protocol Suite 4
Note
The well-known port numbers are
less than 1,024.
TCP/IP Protocol Suite 5
Socket address
TCP/IP Protocol Suite 6
IP addresses versus port numbers
13 Destination port number
selects the process
Data
TCP/IP Protocol Suite 7
Encapsulation and decapsulation
TCP/IP Protocol Suite 8
Multiplexing and demultiplexing
TCP/IP Protocol Suite 9
Position of UDP in the TCP/IP protocol suite
TCP/IP Protocol Suite 10
UDP (User Datagram Protocol)
connectionless, unreliable transport protocol.
It does not add anything to the services of IP
except to provide process-to process
communication instead of host-to-host
communication.
performs very limited error checking.
User datagram format
TCP/IP Protocol Suite 12
UDP Header Format Cont..
• Source port number. This is the port number used by the process running on the source host. It is
16 bits long, which means that the port number can range from 0 to 65,535. If the source host is the
client (a client sending a request), the port number, in most cases, is an ephemeral port number
requested by the process and chosen by the UDP software running on the source host. If the source
host is the server (a server sending a response), the port number, in most cases, is a well-known
port number.
• Destination port number. This is the port number used by the process running on the destination
host. It is also 16 bits long. If the destination host is the server (a client sending a request), the port
number, in most cases, is a well-known port number. If the destination host is the client (a server
sending a response), the port number, in most cases, is an ephemeral port number. In this case, the
server copies the ephemeral port number it has received in the request packet.
• Length. This is a 16-bit field that defines the total length of the user datagram, header plus data.
The 16 bits can define a total length of 0 to 65,535 bytes. However, the total length needs to be
much less because a UDP user datagram is stored in an IP datagram with a total length of 65,535
bytes. The length field in a UDP user datagram is actually not necessary. A user datagram is
encapsulated in an IP datagram.
Example 14.1
The following is a dump of a UDP header in
hexadecimal format.
a. What is the source port number?
b. What is the destination port number?
c. What is the total length of the user datagram?
d. What is the length of the data?
e. Is the packet directed from a client to a server
or vice versa?
f. What is the client process?
TCP/IP Protocol Suite 14
TCP/IP Protocol Suite 15
Pseudoheader for checksum calculation
TCP/IP Protocol Suite 16
Example 14.2
Figure 14.4 shows the checksum calculation for a
very small user datagram with only 7 bytes of
data. Because the number of bytes of data is odd,
padding is added for checksum calculation. The
pseudoheader as well as the padding will be
dropped when the user datagram is delivered to
IP
TCP/IP Protocol Suite 17
Checksum calculation for a simple UDP user datagram
TCP/IP Protocol Suite 18
Example 14.3
What value is sent for the checksum in one of the
following hypothetical situations?
a. The sender decides not to include the
checksum.
b. The sender decides to include the checksum,
but the value of the sum is all 1s.
c. The sender decides to include the checksum,
but the value of the sum is all 0s.
TCP/IP Protocol Suite 19
Example 14.3 Continued
Solution
a. The value sent for the checksum field is all 0s
to show that the checksum is not calculated.
b. When the sender complements the sum, the
result is all 0s; the sender complements the
result again before sending. The value sent for
the checksum is all 1s. The second complement
operation is needed to avoid confusion with the
case in part a.
c. This situation never happens because it implies
that the value of every term
included in the calculation of the sum is all 0s,
which is impossible; some fields in the
pseudoheader have nonzero
TCP/IP Protocol Suite values (see 20
UDP APPLICATION
The following lists some uses of the UDP protocol:
UDP is suitable for a process that requires simple request-response
communication with little concern for flow and error control. It is not
usually used for a process such as FrP that needs to send bulk data.
UDP is suitable for a process with internal flow and error control
mechanisms. For Example, the Trivial File Transfer Protocol (TFTP)
process includes flow and error control. It can easily use UDP.
UDP is a suitable transport protocol for multicasting. Multicasting
capability is embedded in the UDP software but not in the TCP software.
UDP is used for management processes such as SNMP.
UDP is used for some route updating protocols such as Routing
Information Protocol (RIP).
TCP/IP Protocol Suite 21