16 Unit5 Transport Layer Protocols
16 Unit5 Transport Layer Protocols
CB84000D001C001C
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?
Answer
a. The source port number is the first four hexadecimal
digits (CB84), which means that the source port number
is 52100.
b. The destination port number is the second four
hexadecimal digits (000D), which means that the
destination port number is 13.
c. The third four hexadecimal digits (001C) define the
length of the whole UDP packet as 28 bytes.
d. The length of the data is the length of the whole packet
minus the length of the header, or 28 – 8 = 20 bytes.
e. Since the destination port number is 13 (well-known
port), the packet is from the client to the server.
f. The client process is the Daytime.
Typical Applications
• 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 FTP 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.
• UDP is used for management processes such
as SNMP.
Typical Applications
• UDP is a suitable transport protocol for
multicasting. Multicasting capability is
embedded in the UDP software but not in the
TCP software.
• UDP is normally used for real-time
applications that cannot tolerate uneven delay
between sections of a received message.
• UDP is used for some route updating protocols
such as Routing Information Protocol (RIP).
Transmission Control Protocol
• Connection-oriented, reliable
- Provides connection-oriented/stream-oriented
communication over a connectionless network
layer protocol (IP).
• End-to-end full duplex link
- Exactly two end points
- Multicasting or broadcasting is not supported
• Supports flow control and error control
• Described in RFCs 793, 1122, 5681
Process-to-Process Communication
• As with UDP, TCP provides process-to-process
communication using port numbers.
Stream Delivery Service
• TCP, unlike UDP, is a stream-oriented protocol.
• Recall: UDP does not recognize any relationship
between the datagrams (Connectionless)
• TCP creates an environment in which the two
processes seem to be connected by an
imaginary “tube” that carries their bytes across
the Internet.
Sending and Receiving Buffers
• Sending and the receiving processes may not
necessarily write or read data at the same
rate, thus, TCP needs buffers for storage.
Segmentation
• The IP layer, as a service provider for TCP,
needs to send data in packets, not as a stream
of bytes.
• At the transport layer, TCP groups a number of
bytes together into a packet called a segment.
Sequence Numbers
• TCP sequence numbers are used to reconstruct
the data stream with segments placed in the
correct order.
Other TCP Characteristics
• TCP offers full-duplex service, where data can
flow in both directions at the same time.
• Like UDP, TCP performs multiplexing at the
sender and demultiplexing at the receiver.
• TCP, unlike UDP, is a reliable transport protocol.
It uses an acknowledgment mechanism to check
the safe and sound arrival of data.
• TCP provides flow, error, and congestion control.
TCP Segment Format
• The segment consists of a header of 20 to 60
bytes, followed by data from the application.
• Source port address. This is a 16-bit field that
defines the port number of the application
program in the host that is sending the segment.
• Destination port address. This is a 16-bit field
that defines the port number of the application
program in the host that is receiving the segment.
• Sequence number. This 32-bit field defines the
number assigned to the first byte of data
contained in this segment. To ensure connectivity,
each byte to be transmitted is numbered.
• Acknowledgment number. This 32-bit field
defines the byte number that the receiver of
the segment is expecting to receive from the
other party.
• Header length. This 4-bit field indicates the
number of 4-byte words in the TCP header.
The length of the header can be between 20
and 60 bytes.
• Reserved. This is a 6-bit field reserved for
future use.
• Control. enables flow control, connection
establishment and termination, connection
abortion, and the mode of data transfer in TCP.
• Window size. This field defines the window size
of the sending TCP in bytes. (length = 16 bits,
maximum size of window is 65,535 bytes.)
• Checksum. This 16-bit field contains the
checksum.
• Urgent pointer. It defines a value that must be
added to the sequence number to obtain the
number of the last urgent byte in the data
section of the segment.
• Options. There can be up to 40 bytes of optional
information in the TCP header.
Encapsulation
• A TCP segment encapsulates the data received
from the application layer.
• The TCP segment is encapsulated in an IP
datagram, which in turn is encapsulated in a
frame at the data-link layer
TCP Connection Establishment
• The connection establishment in TCP is called
three-way handshaking.
A SYN segment cannot carry data, but it consumes one sequence number.
A SYN + ACK segment cannot carry data, but does consume one sequence number.
TCP Data Transfer
TCP Data Transfer Simplified
• Sequence numbers and acknowledgement
numbers are used to manage exchanges in a
conversation.
TCP Congestion and Flow Control
• TCP manages the window size, data loss and
congestion during a session.
TCP Connection Termination
TCP States
TCP vs. UDP Comparison
TCP vs. UDP Comparison
TCP vs. UDP Comparison