CN Unit - 4
CN Unit - 4
CN Unit - 4
LAYER
PRESENTED BY
MS. P ANUSHA,
ASST PROF, CSE(AIML)
Introduction to Transport Layer
Transport layer builds on the network layer to provide data transport from a
process on a source machine to a process on a destination machine with a
desired level of reliability that is independent of the physical networks currently
in use.
In this layer, packets are were termed as segments for messages from one
transport entity to another.
Without the transport layer, the whole concept of layered protocols would make
little sense.
The transport code runs entirely on the users’ machines, but the network layer
mostly runs on the routers, which are operated by the carrier
Transport layer receives the formatted data from the upper layers, performs
Segmentation, and also implements Flow & Error control to ensure proper data
transmission.
Various responsibilities of a Transport Layer –
1. Process to process delivery
2. End-to-end Connection between hosts
3. Multiplexing and De multiplexing
4. Congestion Control
5. Data integrity and Error Correction
6. Flow Control
Protocols used by Transport Layer to enhance it’s functionalities are :
(i) TCP (Transmission Control Protocol)
(ii) UDP ( User Datagram Protocol)
(iii) DCCP ( Datagram Congestion Control Protocol)
Transport Services
Services provided to Upper layers:
The ultimate goal of the transport layer is to provide efficient, reliable,
and cost-effective data transmission service to its users, normally
processes in the application layer.
The software and/or hardware within the transport layer that does the
work is called the transport entity.
The bottom four layers can be seen as the transport service provider,
whereas the upper layer(s) are the transport service user.
Transport service Primitives
Consider an application with a server and a number of remote clients. To start
with, the server executes a LISTEN primitive, typically by calling a library
procedure that makes a system call that blocks the server until a client turns up
and connection establish between them.
Thus, segments (exchanged by the transport layer) are contained in packets
(exchanged by the network layer). In turn, these packets are contained in
frames (exchanged by the data link layer).
Berkeley sockets
Transport layer protocols are typically responsible for end-to-end communication,
between two specific networked devices ( like client-server , point-to-point).
The core communication mechanism used when establishing and managing
communication between two devices at the transport layer is called a SOCKET.
Basically, socket provides bidirectional FIFO Communication facility over the
network.
Sockets are bound to PORTS with unique port numbers that have been assigned to
each application either by default via industry standard or by the developer.
Port number is a 16-bit numerical value that ranges from 0 to 65535.
Example: FTP Client : 20 / 21 email/SMTP Client : 23
HTTP Client : 80 HTTPS Client :443
Port numbers
SOCKET ADDRESS = IPADDRESS + PORT NUMBER
Socket primitives for TCP
Elements of Transport Protocols
The transport service is implemented by a transport protocol used between
the two transport entities are as follows -
• Addressing
• Connection Establishment
• Connection Release
• Flow Control and Buffering
• Multiplexing
• Crash Recovery
Addressing
When an application (e.g., a user)
process wishes to set up a
connection to a remote application
process, it must specify which one
to connect to end points.
Transport layer : TSAP
(Transport Service Access Point)
using PORT NUMBER
Network Layer: NSAP (Network
Service Access Point) using IP
ADDRESS.
Possible scenario for transport
connection shown in figure.
Connection Establishment
Establishing a connection sounds easy, but it is actually surprisingly tricky.
It would seem sufficient for one transport entity to just send a
CONNECTION REQUEST segment to the destination and wait for a
CONNECTION ACCEPTED reply.
The problem occurs when the network can lose, delay, corrupt, and duplicate
packets (DELAYED DUPLICATES)
There established protocol involves one peer checking with the other using
three-way handshake.
It is a key component of the Transmission Control Protocol (TCP), which is
widely used for communication over the Internet.
Connection Release
Releasing a connection is easier than establishing one.
There are two styles of terminating a connection: asymmetric
release (connection release CR) and symmetric release
(Disconnection release DR).
Flow Control and Buffering
Error control is ensuring that the data is delivered with the desired level
of reliability, usually that all of the data is delivered without any errors
Flow control is keeping a fast transmitter from overrunning a slow
receiver.
Solutions used here are same as Data link layer mechanisms only:
frame carries an error-detecting code - CRC or checksum
frame carries a sequence number to identify any retransmission -
ARQ (Automatic Repeat reQuest).
maximum of one packet at a time - stop-and-wait
to support bidirectional data transfer - Sliding window protocol
Multiplexing
Multiplexing, or sharing several conversations over connections, virtual
circuits, and physical links plays a role in several layers of the network
architecture.
In the transport layer, the need for multiplexing is when a segment comes
in, some way is needed to tell which process to give it to.
Crash Recovery
If hosts and routers are subject to crashes or connections are long-lived
(e.g., large software or media downloads), recovery from these crashes
becomes an issue.
If the transport entity is entirely within the hosts, recovery from network,
and router crashes is straightforward.
The transport entities expect lost segments all the time and know how to
cope with them by using retransmissions.
In an attempt to recover, the server might send a broadcast segment to all
other hosts, announcing that it has just crashed and requesting that its
clients inform it of the status of all open connections.
Internet Transport Protocols
TCP UDP
(transmission (User Datagram
Control Protocol) Protocol)
TCP (Transmission Control Protocol)
TCP (Transmission Control Protocol) was specifically designed to provide
a byte stream over an unreliable internetwork.
An internetwork differs from a single network because different parts may
have wildly different topologies, bandwidths, delays, packet sizes, and other
parameters.
TCP was designed to dynamically adapt to properties of the internetwork and
to be robust in the face of many kinds of failures.
Each machine supporting TCP has a TCP transport entity, either a library
procedure, a user process, or most commonly part of the kernel.
TCP must furnish good performance with the reliability that most
applications want and that IP does not provide.
TCP Service Model
TCP service is obtained by both the sender and the receiver creating end
points, called sockets.
Each socket has a socket number (address) consisting of the IP address of the
host and a 16-bit number local to that host, called a port.
A port is the TCP name for a TSAP( Transport Service Access Points)
Port numbers below 1024 are reserved for standard services that can usually
only be started by privileged users (e.g., root in UNIX systems). They are
called well-known ports.
All TCP connections are full duplex and point-to-point. Full duplex means
that traffic can go in both directions at the same time. Point-to-point means
that each connection has exactly two end points.
TCP does not support multicasting or broadcasting.
TCP Segment Header
Source port & Destination port : each specifies 16-bit filed port numbers.
Sequence number: the sequence number is a 32 bit field that indicates how much data is sent
during the TCP session.
Acknowledgment number: this 32 bit field is used by the receiver to request the next TCP
segment.
DO: this is the 4 bit data offset field, also known as the header length.
RSV: these are 3 bits for the reserved field. They are unused and are always set to 0.
Flags: there are 9 bits for flags, we also call them control bits. We use them to establish
connections, send data and terminate connections.
Window: the 16 bit window field specifies how many bytes the receiver is willing to receive.
Checksum: 16 bits are used for a checksum to check if the TCP header is OK or not.
Urgent pointer: these 16 bits are used when the URG bit has been set, the urgent pointer is used to
indicate where the urgent data ends.
Options: this field is optional and can be anywhere between 0 and 320 bits.
Example of TCP Packet using Wireshark
TCP connection Establishment & Connection
Release
Connections are established and release in TCP by means of the three-way
handshake.
To establish a connection, one side, say, the server, passively waits for an
incoming connection by executing the LISTEN and ACCEPT primitives in
that order, either specifying a specific source or nobody in particular.
To release a connection, either party can send a TCP segment with the FIN
bit set, which means that it has no more data to transmit. When the FIN is
acknowledged, that direction is shut down for new data.
Advantages of TCP
It is a reliable protocol.
It provides an error-checking mechanism as well as one for recovery.
It gives flow control.
It makes sure that the data reaches the proper destination in the exact order that
it was sent.
Open Protocol, not owned by any organization or individual.
It assigns an IP address to each computer on the network and a domain name to
each site thus making each device site to be distinguishable over the network.
Disadvantages of TCP
TCP is made for Wide Area Networks, thus its size can become an issue for
small networks with low resources.
TCP runs several layers so it can slow down the speed of the network.
It is not generic in nature. Meaning, it cannot represent any protocol stack
other than the TCP/IP suite. E.g., it cannot work with a Bluetooth connection.
No modifications since their development around 30 years ago.
Use Cases of TCP
Some important use cases of TCP include the following:
Email delivery
Web browsing
File transfer
Messaging and chat
Virtual private networks (VPNs)
UDP ( User Datagram Protocol)
The Internet protocol suite supports a connectionless transport protocol called UDP
(User Datagram Protocol).
UDP provides a way for applications to send encapsulated IP datagrams without
having to establish a connection.
Both the TCP and UDP protocols send the data over the internet protocol network,
so it is also known as TCP/IP and UDP/IP.
The UDP is a connectionless protocol as it does not create a virtual path to transfer
the data.
UDP does not indicate the transmission order for its datagrams or even confirm
their arrival.
UDP features checksums for ensuring data integrity and port numbers for
defining the role played by the data being transmitted.
UDP Header
Source Port : Source Port is 2 Bytes long field used to identify port number
of source.
Destination Port: It is 2 Bytes long field, used to identify the port of
destined packet.
Length : Length is the length of UDP including header and the data. It is 16-
bits field.
Checksum: Checksum is 2 Bytes long field. It is the 16-bit one’s
complement of the one’s complement sum of the UDP header, pseudo header
of information from the IP header and the data, padded with zero octets at the
end (if necessary) to make a multiple of two octets.
Advantages of UDP
Speed: UDP is faster than TCP because it does not have the overhead of
establishing a connection and ensuring reliable data delivery.
Lower latency: Since there is no connection establishment, there is lower
latency and faster response time.
Simplicity: UDP has a simpler protocol design than TCP, making it easier to
implement and manage.
Broadcast support: UDP supports broadcasting to multiple recipients, making
it useful for applications such as video streaming and online gaming.
Smaller packet size: UDP uses smaller packet sizes than TCP, which can
reduce network congestion and improve overall network performance.
Disadvantages of UDP
No reliability: UDP does not guarantee delivery of packets or order of delivery,
which can lead to missing or duplicate data.
No congestion control: UDP does not have congestion control, which means that
it can send packets at a rate that can cause network congestion.
No flow control: UDP does not have flow control, which means that it can
overwhelm the receiver with packets that it cannot handle.
Vulnerable to attacks: UDP is vulnerable to denial-of-service attacks, where an
attacker can flood a network with UDP packets, overwhelming the network and
causing it to crash.
Limited use cases: UDP is not suitable for applications that require reliable data
delivery, such as email or file transfers, and is better suited for applications that
can tolerate some data loss, such as video streaming or online gaming.
Example of UDP in Wireshark
Remote Procedure Call
Remote Procedure Call (RPC) is a powerful technique for
constructing distributed, client-server based applications.
A remote procedure call is an inter process communication technique that is used
for client-server based applications. It is also known as a subroutine call or a
function call.
It is based on extending the conventional local procedure calling so that the called
procedure need not exist in the same address space as the calling procedure.
The two processes may be on the same system, or they may be on different
systems with a network connecting them.
Advantages of Remote Procedure Call
• Remote procedure calls support process oriented and thread oriented
models.
• The internal message passing mechanism of RPC is hidden from the user.
• The effort to re-write and re-develop the code is minimum in remote
procedure calls.
• Remote procedure calls can be used in distributed environment as well as
the local environment.
• Many of the protocol layers are omitted by RPC to improve performance.
Disadvantages of Remote Procedure Call
• The remote procedure call is a concept that can be implemented in different
ways. It is not a standard.
• There is no flexibility in RPC for hardware architecture. It is only
interaction based.
• There is an increase in costs because of remote procedure call.