Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

MMT - Chương 4 - EN - Transport Layer

Download as pdf or txt
Download as pdf or txt
You are on page 1of 40

FACULTY OF INFORMATION TECHNOLOGY

DEPARTMENT OF NETWORKS AND INFORMATION SYSTEMS

CHAPTER 4

Transport Layer

1
OBJECTIVES
• Describe the purpose of the layer in managing the transportation of data in end-to-end communication

• Describe characteristics of the TCP and UDP protocols

• Explain how TCP and UDP work

KEY WORDS
• The Transport Layer

• UDP Protocol

• TCP Protocol

2
CONTENTS

• Part 1: The Transport Layer

• Part 2: UDP Protocol

• Part 3: TCP Protocol

3
Transport Layer
Transport Layer – Overview

The transport layer is

• responsible for establishing a temporary


communication session between two
applications and delivering data between them

• the link between the application layer and the


lower layers in TCP/IP model

4
Transport Layer
Transport Layer – Overview
The primary responsibilities of transport layer:
• Tracking Individual Conversations
• Segmenting Data and Reassembling Segments
• Identifying the Applications

5
Transport Layer
Transport Layer – Overview

The primary responsibilities of transport layer:

• Tracking Individual Conversations


✓ Tracking the individual communication between applications on the source and destination hosts

• Segmenting Data and Reassembling Segments


✓ Segmenting data for manageability and reassembling segmented data into streams of application
data at the destination

• Identifying the Applications


✓ Identifying the proper application for each communication stream

6
Transport Layer
Transport Layer – Overview
Transport layer protocols:
• The transport layer ensures the data can be properly put back together on the receiving end, by
segmentation and reassembly processes
• In TCP/IP, these processes can be achieved using two very different transport layer protocols:
✓ Transmission Control Protocol (TCP): define by IETF in RFC 793
✓ User Datagram Protocol (UDP): define by IETF in RFC 768

7
Transport Layer
Transport Layer – Overview
Transport layer protocols:

• TCP is a connection-oriented reliable protocol

• UDP is a simple connectionless protocol

8
Transport Layer
Transport Layer – Encapsulation
Transport layer encapsulation:

• The encapsulated data in Transport layer is called Segments or Datagrams.

• If the transmission uses

✓ TCP: Segment

✓ UDP: Datagram

9
Transport Layer
Transport Layer – Port Number and Socket
What is a port number ?

• A port is a part of the transport layer and helps in


network communication.

• Each port is represented by a 16-bit unsigned integer


number that is assigned by IANA.

• A port number is associated with a transport layer


protocol to describe an application in the host.

• Examples.
✓ TCP/80 = HTTP; UDP/161 = SNMP
✓ TCP/53 or UDP/53 = DNS
10
Transport Layer
Transport Layer – Port Number and Socket
Types of port number:

The range of port number is 0 to 65535 and the port numbers are divided into three categories:
• Well-known ports: for services and applications (Ex. DNS, HTTP, SNMP,...)
• Registered ports: for user application or user process
• Dynamic ports (Ephemeral ports): These are assigned dynamically to client applications when the client
initiates a connection to a service.

11
Transport Layer
Transport Layer – Port Number and Socket
Socket concept:

• A port number is a unique identifier used


with an IP address to create a socket.

• A socket uniquely identifies the endpoint


of a communication link between two
application ports.

• A socket (or socket address) has three


parts: transport layer protocol, local-
address, local-port number (on a host).

12
User Datagram Protocol
UDP – Overview
UDP basic functions

UDP provides the basic functions for delivering datagrams between the appropriate applications, with very
little overhead and data checking.

• UDP is a connectionless protocol.

• UDP is known as a best-effort delivery protocol because there is no acknowledgment that the data is
received at the destination.

13
User Datagram Protocol
UDP – Overview
UDP features

• Data is reconstructed in the order that it is received.

• Any segments that are lost are not resent.

• There is no session establishment.

• The sending is not informed about resource availability.

14
User Datagram Protocol
UDP – Overview
Applications that use UDP

Live video and multimedia applications


• These applications can tolerate some data loss but require little or no delay.
• Examples include VoIP and live streaming video.

Simple request and reply applications


• Applications with simple transactions where a host sends a request and may
or may not receive a reply.
• Examples include DNS and DHCP.

Applications that handle reliability themselves


• Unidirectional communications where flow control, error detection,
acknowledgment and error recovery or can be handled by the application.
• Examples include SNMP and TFTP.

15
User Datagram Protocol
UDP – Header format
UDP header: 8 bytes

16
User Datagram Protocol
UDP – Well Known Port Numbers

17
User Datagram Protocol
UDP – Communication
Low resource consumption and low reliability

• UDP does not establish a connection.

• UDP provides low overhead data transport because it has a small header and no network management
traffic.

18
User Datagram Protocol
UDP – Communication

UDP Datagram Reassembly

• UDP does not track sequence numbers.

• UDP has no way to reorder the datagrams into their


transmission order.

• UDP simply reassembles the data in the order that it


was received and forwards it to the application.

19
User Datagram Protocol
UDP – Communication
UDP Server Processes and Requests

• UDP-based server applications are assigned well-known or registered port numbers.


• UDP receives a datagram destined for one of these ports, it forwards the application data to the
appropriate application based on its port number.

20
User Datagram Protocol
UDP – Communication
UDP Client Processes

• The UDP client process dynamically selects a


port number from the range of port numbers and
uses this as the source port for the conversation.

• The destination port is usually the well-known or


registered port number assigned to the server
process.

• After a client has selected the source and


destination ports, the same pair of ports are used
in the header of all datagrams in the transaction.
21
Transmission Control Protocol
TCP – Overview
TCP basic functions

TCP provides reliability and flow control. TCP basic operations:

• Number and track data segments transmitted to a specific host from a specific application

• Acknowledge received data

• Retransmit any unacknowledged data after a certain amount of time

• Sequence data that might arrive in wrong order

• Send data at an efficient rate that is acceptable by the receiver


22
Transmission Control Protocol
TCP – Overview
TCP features
• Establishes a Session - TCP is a connection-oriented protocol that negotiates and establishes a connection (or
session) between source and destination devices prior to forwarding any traffic.

• Ensures Reliable Delivery - For many reasons, it is possible for a segment to become corrupted or lost, as it is
transmitted over the network. TCP ensures that each segment that is sent by the source arrives at the destination.

• Supports Flow Control - Network hosts have limited resources (i.e., memory and processing power). When TCP
is aware that these resources are overtaxed, it can request that the sending application reduce the rate of data flow.

• Provides Same-Order Delivery - Because networks may provide multiple routes that can have different
transmission rates, data can arrive in the wrong order.

23
Transmission Control Protocol
TCP – Overview
Applications that use TCP

• TCP handles all tasks associated with dividing the data stream into segments, providing reliability,
controlling data flow, and reordering segments.

24
Transmission Control Protocol
TCP – Header format
TCP header: 20 – 60 bytes

25
Transmission Control Protocol
TCP – Header format

26
Transmission Control Protocol
TCP – Well Known Port Numbers

27
Transmission Control Protocol
TCP – Communication
TCP Server Processes

Each application process running on a server is configured to use


a port number.

• An individual server cannot have two services assigned to the


same port number within the same transport layer services.

• An active server application assigned to a specific port is


considered open, which means that the transport layer
accepts, and processes segments addressed to that port.

• Any incoming client request addressed to the correct socket


is accepted, and the data is passed to the server application.

28
Transmission Control Protocol
TCP – Communication
TCP Connection Establishment (or Setup)

• Step 1: The initiating client requests a client-to-server


communication session with the server.

• Step 2: The server acknowledges the client-to-server


communication session and requests a server-to-client
communication session.

• Step 3: The initiating client acknowledges the server-to-


client communication session.

29
Transmission Control Protocol
TCP – Communication
Session Termination or TCP Shutdown

• Step 1: When the client has no more data to send in the


stream, it sends a segment with the FIN flag set.

• Step 2: The server sends an ACK to acknowledge the


receipt of the FIN to terminate the session from client
to server.

• Step 3: The server sends a FIN to the client to terminate


the server-to-client session.

• Step 4: The client responds with an ACK to


acknowledge the FIN from the server.
30
Transmission Control Protocol
TCP – Reliability and Flow Control
TCP Reliability- Guaranteed and Ordered Delivery

• TCP can also help maintain the flow of packets so that


devices do not become overloaded.

• There may be times when TCP segments do not arrive


at their destination or arrive out of order.

• All the data must be received and the data in these


segments must be reassembled into the original order.

• Sequence numbers are assigned in the header of each


packet to achieve this goal.

31
Transmission Control Protocol
TCP – Reliability and Flow Control

TCP Reliability – Data Loss and Retransmission

• No matter how well designed a network is, data


loss occasionally occurs.

• TCP provides methods of managing these


segment losses. Among these is a mechanism to
retransmit segments for unacknowledged data.

• Recently, an optional feature called selective


acknowledgment (SACK) is commonly used
during TCP session establishment

32
Transmission Control Protocol
TCP – Reliability and Flow Control
TCP Flow Control – Window Size and Acknowledgments

TCP also provides mechanisms for flow control as follows:

• Flow control is the amount of data that the destination


can receive and process reliably.

• Flow control helps maintain the reliability of TCP


transmission by adjusting the rate of data flow between
source and destination for a given session.

Note:

• TCP uses Window Size or Window Sliding mechanism


to control flow 33
Transmission Control Protocol
TCP – Reliability and Flow Control
TCP Flow Control – Maximum Segment Size

Maximum Segment Size (MSS) is the maximum amount


of data that the destination device can receive.

• A common MSS is 1,460 bytes when using IPv4.

• A host determines the value of its MSS field by


subtracting the IP and TCP headers from the Ethernet
maximum transmission unit (MTU), which is 1500
bytes be default.

• 1500 minus 60 (20 bytes for the IPv4 header and 20


bytes for the TCP header) leaves 1460 bytes.
34
Transmission Control Protocol
TCP – Reliability and Flow Control
TCP Flow Control – Congestion Avoidance

• When congestion occurs on a network, it


results in packets being discarded by the
overloaded router.

• To avoid and control congestion, TCP


employs several congestion handling
mechanisms, timers, and algorithms.

35
Transmission Control Protocol
TCP – Connection Setup Example
An example about TCP Connection Setup

• Before sending data, devices establish a connection through a three-way handshake.

36
Transmission Control Protocol
TCP – Reliability Example
An example about TCP Reliability

• Sequence Number and Acknowledgement Number fields are used to implement reliable and ordered
data transmission in TCP

37
Transmission Control Protocol
TCP –Flow Control Example
An example about TCP Flow Control (Window Sliding Mechanism)

• TCP uses the sliding window mechanism to control the data transmission rate

38
Transmission Control Protocol
TCP – Session Termination Example
An example about TCP Shutdown (Four-Way Handshake)

• After data transmission is complete, TCP needs to use the four-way handshake mechanism to
disconnect the TCP connection and release system resources

39
Questions and Answers

40

You might also like