0% found this document useful (0 votes)
37 views46 pages

Chapter 3A OSI Transport Layer

Uploaded by

Omar Zamzami
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views46 pages

Chapter 3A OSI Transport Layer

Uploaded by

Omar Zamzami
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 46

OSI Transport Layer

Roles of the Transport Layer


The following are the primary responsibilities of the transport layer:

1. Tracking the individual communications between applications on


the source and destination hosts
2. Segmenting data and managing each piece
3. Reassembling the segments into streams of application data
4. Identifying the different applications
5. Performing flow control between end users
6. Enabling error recovery
7. Initiating a session
1-Tracking Individual Conversations
• hosts can have multiple applications (e.g. VoIP call, email) that are
communicating across the network. The transport layer maintains the
multiple communication streams between these applications.
2- Segmenting Data
• The application layer passes large amounts of data to the transport
layer. The transport layer has to break the data into smaller pieces
(segments), better suited for transmission.
• This process includes the encapsulation required on each piece of
data by adding a header.
• Segmentation provides the means to both send
and receive data when running multiple
applications concurrently on a computer.
• Without segmentation, only one application, the
streaming video, for example, would be able to
receive data.
3- Reassembling Segments
• Because networks can provide multiple routes that can have different
transmission times, data can arrive in the wrong order. By numbering
and sequencing the segments, the transport layer can ensure that
these segments are reassembled into the proper order.

• At the receiving host, each segment of data must be reassembled in


the correct order and then directed to the appropriate application.
4- Identifying the Applications
• To pass data streams to the proper applications, the transport layer
must identify the target application. To accomplish this, the transport
layer assigns an identifier to an application (i.e. port number).

• The port number is used in the transport layer header to indicate to


which application that piece of data is associated.
5- Flow Control
• Network hosts have limited resources, such as memory or bandwidth.
When the transport layer is aware that these resources are overtaxed,
some protocols can request that the sending application reduce the
rate of data flow.

• Flow control can prevent the loss of segments on the network and
avoid the need for retransmission
6- Error Recovery
• It is possible for a piece of data to become corrupted, or lost, as it is
transmitted over the network. The transport layer can ensure that all
pieces reach their destination by having the source device retransmit
any data that is lost.

7- Initiating a Session
• The transport layer can provide connection orientation by creating a
session between the applications. These connections prepare the
applications to communicate with each other before any data is
transmitted
Data Requirements Vary
• Different applications have different requirements for their data, and
therefore different transport protocols have been developed to meet
these requirements.
• For example, users require that an e-mail or web page be completely
received. Slight delays are considered acceptable.
• In contrast, occasionally missing small parts of a telephone
conversation might be considered acceptable.
• Some protocols, such as UDP (User Datagram Protocol), provide just
the basic functions for efficiently delivering. These types of protocols
are useful for applications whose data is sensitive to delays.
• Other transport layer protocols, such as TCP (Transmission Control
Protocol), offers additional features, such as ensuring reliable delivery
between the applications.
• While these additional functions provide more robust communication
at the transport layer between applications, they have additional
overhead and make larger demands on the network.
• TCP is a transport layer protocol that can be implemented to ensure
reliable delivery of the data.
• Reliability means ensuring that each piece of data that the source
sends arrives at the destination
• At the transport layer, the three basic operations of reliability are
1. Tracking transmitted data
2. Acknowledging received data
3. Retransmitting any unacknowledged data

• To support these reliability operations, more control data is


exchanged between the sending and receiving hosts. This control
information is contained in the Layer 4 header.
How about applications such as database
TCP and UDP
• The two most common transport layer protocols of the TCP/IP
protocol suite are Transmission Control Protocol (TCP) and User
Datagram Protocol (UDP).
• Both protocols manage the communication of multiple applications.
• At the transport layer, each particular set of pieces flowing between a
source application and a destination application is known as a
conversation
Transmission Control Protocol (TCP)
• TCP is a connection-oriented protocol, described in RFC 793. TCP incurs
additional overhead to gain functions. Additional functions specified by TCP
are same-order delivery, reliable delivery, and flow control.
• Each TCP segment has 20 bytes of overhead in the header encapsulating
the application layer data.

• The following applications use TCP:


• ■ Web browsers
• ■ E-mail
• ■ File transfers
TCP Datagram
Port Addressing
• Consider the earlier example of a computer simultaneously receiving
and sending e-mail, instant messages, web pages, and a VoIP phone
call.
• The TCP- and UDP-based services keep track of the various
applications that are communicating.
• To differentiate the segments and datagrams for each application,
both TCP and UDP have header fields that can uniquely identify these
applications.
Identifying the Conversations
• The header of each segment or datagram contains a source and
destination port.
• Port numbers are assigned in various ways, depending on whether
the message is a request or a response. While server processes have
static port numbers assigned to them, clients dynamically choose a
port number for each conversation.
• When a client application sends a request to a server application, the
destination port contained in the header is the port number that is
assigned to the service daemon running on the remote host.
• The client software must know what port number is associated with
the server process on the remote host
• when a web browser application makes a request to a web server, the
browser uses TCP and port number 80 unless otherwise specified. TCP
port 80 is the default port assigned to web-serving applications.
• The source port in a segment or datagram header of a client request
is randomly generated. This port number acts like a return address for
the requesting application.
• The transport layer keeps track of this port and the application that
initiated the request so that when a response is returned, it can be
forwarded to the correct application.
TCP: Communicating with Reliability
• The key distinction between TCP and UDP is reliability. The reliability
of TCP communication is performed using connection-oriented
sessions. Before a host using TCP sends data to another host, the
transport layer initiates a process to create a connection with the
destination.
• This connection enables the tracking of a session, or communication
stream, between the hosts. This process ensures that each host is
aware of and prepared for the communication.
• A complete TCP conversation requires the establishment of a session
between the hosts in both directions
TCP: Communicating with Reliability
• After a session has been established, the destination sends
acknowledgments to the source for the segments that it receives.
• As the source receives an acknowledgment, it knows that the data
has been successfully delivered and can quit tracking that data.
• If the source does not receive an acknowledgment within a
predetermined amount of time, it retransmits that data to the
destination.
• Part of the additional overhead of using TCP is the network traffic
generated by acknowledgments and retransmissions. (segments for
establishment of the sessions, segments for tracking of
acknowledgments and the retransmission process)
TCP Server Processes
• Application processes run on servers. These processes wait until a client
initiates communication with a request for information or other services.
• Each application process running on the server is configured to use a
port number .
• When an active server application is assigned to a specific port, that port
is considered to be “open” on the server. This means that the transport
layer accepts and processes segments addressed to that port.
• Any incoming client request addressed to the correct socket (i.e. IP
address + port number) is accepted, and the data is passed to the server
application.
• It is common for a server to provide more than one service, such as a
web server and an FTP server, at the same time.
Clients Sending TCP Requests
TCP Connection Establishment and Termination
• When two hosts communicate using TCP, a connection is established
before data can be exchanged.

• After the communication is completed, the sessions are closed and


the connection is terminated.

• The connection and session mechanisms enable TCP’s reliability


function.
TCP connection establishment: TCP Three-
Way Handshake
• The host tracks each data segment within a session and exchanges
information about what data is received by each host using the
information in the TCP header.

• To establish the connection, the hosts perform a three-way


handshake.

• Control bits (code bits) in the TCP header indicate the progress and
status of the connection.
TCP Three-Way Handshake
• The three-way handshake performs the following functions:
1. Establishes that the destination device is present on the network.
2. Verifies that the destination device has an active service and is
accepting requests on the destination port number.
3. Informs the destination device that the source client intends to
establish a communication session on that port number
• The three steps in TCP connection establishment are as follows:

1. The initiating client sends a segment containing an initial sequence


value, which serves as a request to the server to begin a
communications session.

2. The server responds with a segment containing an acknowledgment


value equal to the received sequence value plus 1, plus its own
synchronizing sequence value.

• The initiating client responds with an acknowledgment value equal to


the sequence value it received plus 1. This completes the process of
establishing the connection.
• Within the TCP segment header, the following six 1-bit fields (flags)
contain control information used to manage the TCP processes:
• URG: Urgent pointer field significant.
• ACK: Acknowledgment field significant.
• SYN: Synchronize sequence numbers
• RST: Reset the connection TCP Connection Establishment: SYN ACK
• PSH: Push function
• FIN: No more data from
sender
• Step 1: SYN: A TCP client begins the three-way handshake by sending
a segment with the SYN control flag set, indicating an initial value in
the sequence number field in the header.
• This initial value for the sequence number is randomly chosen and is
used to begin tracking the flow of data from the client to the server
for this session.
• Step 2: SYN and ACK: The TCP server needs to acknowledge the
receipt of the SYN segment from the client to establish the session.
• To do that, the server sends a segment back to the client with the ACK
flag set, indicating that the acknowledgment number is significant.
• With this flag set in the segment, the client recognizes this as an
acknowledgment that the server received the SYN from the TCP
client.
• The value of the acknowledgment number field is equal to the client
ISN plus 1.
• In this second step of the three-way handshake, the server must
initiate the response from the server to the client. To start this
session, the server uses the SYN flag in the same way that the client
did.
• Step 3: ACK: Finally, the TCP client responds with a segment
containing an ACK that is the response to the TCP SYN sent by the
server.
TCP Session Termination
• To close a connection, the FIN control flag in the segment header
must be set. To end each one-way TCP session, a two-way handshake
is used, consisting of a FIN segment and an ACK segment.
1. When the client has no more data to send in the stream, it sends a
segment with the FIN flag set.
2. The server sends an ACK to acknowledge the receipt of the FIN to
terminate the session from client to server.
3. The server sends a FIN to the client, to terminate the server-to-
client session.
4. The client responds with an ACK to acknowledge the FIN from the
server.
TCP Connection Termination: FIN ACK
TCP Acknowledgment with Windowing
• One of TCP’s functions is to make sure that each segment reaches its
destination. The TCP services on the destination host acknowledge the
data that they have received to the source application.
• The sequence number indicates the relative number of bytes that have
been transmitted in this session, including the bytes in the current
segment.
• TCP uses the acknowledgment number in segments sent back to the
source to indicate the next byte in this session that the receiver expects
to receive.
• The source is informed that the destination has received all bytes in this
data stream up to, but not including, the byte indicated by the
acknowledgment number.
• The sending host is expected to send a segment that uses a sequence
number that is equal to the acknowledgmentnumber.
In the figure, the host on the left is sending data to the host on the right. It sends a segment
containing 10 bytes of data for this session and a sequence number equal to 1 in the
header.
• Host B receives the segment and determines that the sequence
number is 1 and that it has 10 bytes of data.

• Host B then sends a segment back to host A to acknowledge the


receipt of this data. In this segment, the host sets the
acknowledgment number to 11 to indicate that the next byte of data
it expects to receive in this session is byte number 11.

• When host A receives this acknowledgment, it can now send the next
segment containing data for this session starting with byte number
11.
window size
• if host A had to wait for acknowledgment of the receipt of each 10
bytes, the network would have a lot of overhead.
• To reduce the overhead of these acknowledgments, multiple
segments of data can be sent and acknowledged with a single TCP
message in the opposite direction.
• This acknowledgment contains an acknowledgment number based on
the total number of segments received in the session.
• For example, starting with a sequence number of 2000, if 10
segments of 1000 bytes each were received, an acknowledgment
number of 12001 would be returned to the source.
window size
• The amount of data that a source can transmit before an
acknowledgment must be received
• is called the window size. Window size is a field in the TCP header
that enables the management of lost data and flow control.
TCP Retransmission
• A destination host usually only acknowledges data for contiguous
sequence bytes. If one or more segments are missing, only the data in
the segments that complete the stream is acknowledged.
• For example, if segments with sequence numbers 1500 to 3000 and
3400 to 3500 were received, the acknowledgment number would be
3001, because segments with the sequence numbers 3001 to 3399
have not been received.
• When the source host has not received an acknowledgment after a
predetermined amount of time, it will go back to the last
acknowledgment number that it received and retransmit data from
that point forward
TCP Congestion Control: Flow Control
• When the source is informed that the specified amount of data in the
segments is received, it can continue sending more data for this
session.
• The window size field in the TCP header specifies the amount of data
that can be transmitted before an acknowledgment must be received.
The initial window size is determined during the session startup
through the three-way handshake.
• Exp: the initial window size for a session represented is set to 3000
bytes. When the sender has transmitted 3000 bytes, it waits for an
acknowledgment of these bytes before transmitting more segments in
this session. After the sender has received this acknowledgment from
the receiver, the sender can transmit an additional 3000 bytes.
User Datagram Protocol (UDP)
• is a simple, connectionless protocol. It has the advantage of providing
low-overhead communication and data delivery. The segments of
communication in UDP are called datagrams.
• Applications that use UDP include DNS, video streaming and VoIP.
• Some applications, such as online games or VoIP, can tolerate loss of
some data. If these applications used TCP, they might experience large
delays while TCP detects data loss and retransmits data.
• other applications, such as DNS, will simply retry the request if they
do not receive a response, and therefore they do not need TCP to
guarantee the message delivery.
UDP Datagram Reassembly
• Many applications that use UDP send small amounts of data that can
fit in one segment. However, some applications will send larger
amounts of data that must be split into multiple segments
• When multiple datagrams are sent to a destination, they can take
different paths and arrive in the wrong order. UDP does not keep track
of sequence numbers the way TCP does.
• UDP has no way to reorder the datagrams into their transmission
order.
UDP Server Processes and Requests
• Like TCP-based applications, UDP-based server applications are
assigned well-known or registered port numbers.
• When these applications or processes are running, they will accept
• the data matched with the assigned port number.
• When UDP receives a datagram destined for one of these ports, it
forwards the application data to the appropriate application based on
its port number
UDP Client Processes
• As with TCP, client/server communication is initiated by a client
application that is requesting data from a server process.
• The UDP client process randomly selects a port number and uses this
as the source port for the conversation.
• The destination port will usually be the well-known or registered port
number assigned to the server process.
• Because UDP does not create a session, as soon as the data is ready
to be sent and the ports are identified, UDP can form the datagram
and pass it to the network layer to be addressed and sent on the
network.

You might also like