SlideShare a Scribd company logo
KARPAGAM INSTITUTE OF TECHNOLOGY
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Course Code with Name :CS8591/Computer
Networks
Staff Name / Designation : Mrs.C.Kalpana / AP
Department : CSE
Year/Semester : III/V
1
Karpagam Institute of Technology
4/5/2022
UNIT – IV
TRANSPORT LAYER
4/5/2022 Karpagam Institute of Technology 2
Introduction – Transport Layer Protocols –
Services – Port Numbers – User Datagram
Protocol – Transmission Control Protocol –
SCTP.
INTRODUCTION
 The transport layer is the fourth layer of the
OSI model and is the core of the Internet
model.
 It responds to service requests from the
session layer and issues service requests
to the network Layer.
 The transport layer provides transparent
transfer of data between hosts.
 It provides end-to-end control and
information transfer with the quality of service
needed by the application program.
 It is the first true end-to-end layer,
implemented in all End Systems (ES).
4/5/2022 Karpagam Institute of Technology 3
4/5/2022 Karpagam Institute of Technology 4
4/5/2022 Karpagam Institute of Technology 5
TRANSPORT LAYER
FUNCTIONS / SERVICES
 The transport layer is located between
the network layer and the application
layer.
 The transport layer is responsible for
providing services to the application
layer; it receives services from the
network layer.
4/5/2022 Karpagam Institute of Technology 6
TRANSPORT LAYER
FUNCTIONS / SERVICES
 The services that can be provided by
the transport layer are
1. Process-to-Process Communication
2. Addressing : Port Numbers
3. Encapsulation and Decapsulation
4. Multiplexing and Demultiplexing
5. Flow Control
6. Error Control
7. Congestion Control
4/5/2022 Karpagam Institute of Technology 7
Process-to-Process
Communication
 The Transport Layer is responsible for
delivering data to the appropriate
application process on the host
computers.
 This involves multiplexing of data from
different application processes, i.e.
forming data packets, and adding source
and destination port numbers in the
header of each Transport Layer data
packet.
 Together with the source and destination
IP address, the port numbers constitutes
a network socket, i.e. an identification
address of the process-to-process
4/5/2022 Karpagam Institute of Technology 8
Addressing: Port Numbers
 Ports are the essential ways to address multiple
entities in the same location.
 Using port addressing it is possible to use more
than one network-based application at the same
time.
 Three types of Port numbers are used :
Well-known ports - These are permanent port
numbers. They range between 0 to 1023.These
port numbers are used by Server Process.
Registered ports - The ports ranging from 1024 to
49,151 are not assigned or controlled.
Ephemeral ports (Dynamic Ports) – These are
temporary port numbers. They range between
49152–65535.These port numbers are used by
Client Process.
4/5/2022 Karpagam Institute of Technology 9
Encapsulation and
Decapsulation
 To send a message from one process to
another, the transport-layer protocol
encapsulates and decapsulates messages.
 Encapsulation happens at the sender site.
The transport layer receives the data and
adds the transport-layer header.
 Decapsulation happens at the receiver site.
When the message arrives at the
destination transport layer, the header is
dropped and the transport layer delivers the
message to the process running at the
application layer. 4/5/2022 Karpagam Institute of Technology 10
Multiplexing and
Demultiplexing
 Whenever an entity accepts items from
more than one source, this is referred to as
multiplexing (many to one).
 Whenever an entity delivers items to more
than one source, this is referred to as
demultiplexing (one to many).
 The transport layer at the source performs
multiplexing
 The transport layer at the destination
performs demultiplexing
4/5/2022 Karpagam Institute of Technology 11
Flow Control
 Flow Control is the process of managing
the rate of data transmission between
two nodes to prevent a fast sender from
overwhelming a slow receiver.
 It provides a mechanism for the receiver to
control the transmission speed, so that
the receiving node is not overwhelmed with
data from transmitting node.
4/5/2022 Karpagam Institute of Technology 12
Flow Control
4/5/2022 Karpagam Institute of Technology 13
Error Control
 Error control at the transport layer is
responsible for
1. Detecting and discarding corrupted
packets.
2. Keeping track of lost and discarded
packets and resending them.
3. Recognizing duplicate packets and
discarding them.
4. Buffering out-of-order packets until the
missing packets arrive.
 Error Control involves Error Detection and
Error Correction 4/5/2022 Karpagam Institute of Technology 14
Error Control
4/5/2022 Karpagam Institute of Technology 15
Congestion Control
 Congestion in a network may occur if the load on the
network (the number of packets sent to the network)
is greater than the capacity of the network (the
number of packets a network can handle).
 Congestion control refers to the mechanisms and
techniques that control the congestion and keep the
load below the capacity.
 Congestion Control refers to techniques and
mechanisms that can either prevent congestion,
before it happens, or remove congestion, after it has
happened
 Congestion control mechanisms are divided into two
categories,
1. Open loop - prevent the congestion before it
happens. 4/5/2022 Karpagam Institute of Technology 16
PORT NUMBERS
 A transport-layer protocol usually has several
responsibilities.
 One is to create a process-to-process
communication.
 Processes are programs that run on hosts. It could
be either server or client.
 A process on the local host, called a client, needs
services from a process usually on the remote host,
called a server.
 Processes are assigned a unique 16-bit port number
on that host.
 Port numbers provide end-to-end addresses at the
transport layer
 They also provide multiplexing and demultiplexing at
this layer. 4/5/2022 Karpagam Institute of Technology 17
PORT NUMBERS
4/5/2022 Karpagam Institute of Technology 18
 ICANN (Internet Corporation for Assigned
Names and Numbers) has divided the port
numbers into three ranges:
◦ Well-known ports
◦ Registered
◦ Ephemeral ports (Dynamic Ports)
4/5/2022 Karpagam Institute of Technology 19
WELL-KNOWN PORTS
 These are permanent port numbers used by
the servers.
 They range between 0 to 1023.
 This port number cannot be chosen
randomly.
 These port numbers are universal port
numbers for servers.
 Every client process knows the well-known
port number of the corresponding server
process.
 For example, while the daytime client
process, a well-known client program, can
use an ephemeral (temporary) port number,
52,000, to identify itself, the daytime server
process must use the well-known
4/5/2022 Karpagam Institute of Technology 20
WELL-KNOWN PORTS
4/5/2022 Karpagam Institute of Technology 21
EPHEMERAL PORTS
(DYNAMIC PORTS)
 The client program defines itself with a port
number, called the ephemeral port number.
 The word ephemeral means “short-lived” and
is used because the life of a client is normally
short.
 An ephemeral port number is recommended
to be greater than 1023.
 These port number ranges from 49,152 to
65,535
 They are neither controlled nor registered.
They can be used as temporary or private
port numbers.
4/5/2022 Karpagam Institute of Technology 22
REGISTERED PORTS
 The ports ranging from 1024 to 49,151
are not assigned or controlled.
4/5/2022 Karpagam Institute of Technology 23
TRANSPORT LAYER
PROTOCOLS
 Three protocols are associated with the
Transport layer.
 They are
(1) UDP –User Datagram Protocol
(2) TCP – Transmission Control Protocol
(3) SCTP - Stream Control Transmission
Protocol
 Each protocol provides a different type of
service and should be used appropriately.
4/5/2022 Karpagam Institute of Technology 24
 UDP - UDP is an unreliable connectionless
transport-layer protocol used for its simplicity and
efficiency in applications where error control can be
provided by the application-layer process.
 TCP - TCP is a reliable connection-oriented
protocol that can be used in any application where
reliability is important.
 SCTP - SCTP is a new transport-layer protocol
designed to combine some features of UDP and
TCP in an effort to create a better protocol for
multimedia communication.
4/5/2022 Karpagam Institute of Technology 25
USER DATAGRAM PROTOCOL (UDP)
 User Datagram Protocol (UDP) is a connectionless,
unreliable transport protocol.
 UDP adds process-to-process communication to best-
effort service provided by IP.
 UDP is a very simple protocol using a minimum of
overhead.
 UDP is a simple demultiplexer, which allows multiple
processes on each host to communicate.
 UDP does not provide flow control , reliable or
ordered delivery.
 UDP can be used to send small message where
reliability is not expected.
 Sending a small message using UDP takes much less
interaction between the sender and receiver.
 UDP allow processes to indirectly identify each other
using an abstract locator called port or mailbox
4/5/2022 Karpagam Institute of Technology 26
UDP PORTS
 Processes (server/client) are identified by an abstract
locator known as port.
 Server accepts message at well known port.
 Some well-known UDP ports are
7–Echo, 53–DNS, 111–RPC, 161–SNMP, etc.
 < port, host > pair is used as key for demultiplexing.
 Ports are implemented as a message queue.
 When a message arrives, UDP appends it to end of the
queue.
 When queue is full, the message is discarded.
 When a message is read, it is removed from the queue.
 When an application process wants to receive a
message, one is removed from the front of the queue.
 If the queue is empty, the process blocks until a
message becomes available.
4/5/2022 Karpagam Institute of Technology 27
4/5/2022 Karpagam Institute of Technology 28
UDP DATAGRAM (PACKET) FORMAT
 UDP packets are known as user datagrams
.
 These user datagrams, have a fixed-size
header of 8 bytes made of four fields, each
of 2 bytes (16 bits).
4/5/2022 Karpagam Institute of Technology 29
Source Port Number
 Port number used by process on source host with 16
bits long.
 If the source host is client (sending request) then the
port number is an temporary one requested by the
process and chosen by UDP.
 If the source is server (sending response) then it is
well known port number.
Destination Port Number
 Port number used by process on Destination host with 16 bits
long.
 If the destination host is the server (a client sending request)
then the port number is a well known port number.
 If the destination host is client (a server sending response) then
port number is an temporary one copied by server from the
request packet.
4/5/2022 Karpagam Institute of Technology 30
Length
 This field denotes the total length of the UDP
Packet (Header plus data)
 The total length of any UDP datagram can be
from 0 to 65,535 bytes.
Checksum
 UDP computes its checksum over the UDP
header, the contents of the message body, and
something called the pseudoheader.
 The pseudoheader consists of three fields from
the IP header—protocol number, source IP
address, destination IP address plus the UDP
length field.
Data
 Data field defines tha actual payload to be
transmitted.
 Its size is variable.
4/5/2022 Karpagam Institute of Technology 31
UDP SERVICES
Process-to-Process Communication
 UDP provides process-to-process
communication using socket
addresses, a combination of IP
addresses and port numbers.
4/5/2022 Karpagam Institute of Technology 32
UDP SERVICES
Connectionless Services
 UDP provides a connectionless service.
 There is no connection establishment and no
connection termination .
 Each user datagram sent by UDP is an
independent datagram.
 There is no relationship between the different
user datagrams even if they are coming from
the same source process and going to the
same destination program.
 The user datagrams are not numbered.
 Each user datagram can travel on a different
path.
4/5/2022 Karpagam Institute of Technology 33
UDP SERVICES
Flow Control
 UDP is a very simple protocol.
 There is no flow control, and hence no
window mechanism.
 The receiver may overflow with incoming
messages.
 The lack of flow control means that the
process using UDP should provide for this
service, if needed.
4/5/2022 Karpagam Institute of Technology 34
UDP SERVICES
Error Control
 There is no error control mechanism in UDP
except for the checksum.
 This means that the sender does not know if a
message has been lost or duplicated.
 When the receiver detects an error through the
checksum, the user datagram is silently
discarded.
 The lack of error control means that the
process using UDP should provide for
this service, if needed.
4/5/2022 Karpagam Institute of Technology 35
UDP SERVICES
Checksum
 UDP checksum calculation includes three
sections: a pseudoheader, the UDP header,
and the data coming from the application
layer.
 The pseudoheader is the part of the header
in which the user datagram is to be
encapsulated with some fields filled with 0s.
4/5/2022 Karpagam Institute of Technology 36
UDP SERVICES
Optional Inclusion of Checksum
 The sender of a UDP packet can choose
not to calculate the checksum.
 In this case, the checksum field is filled with
all 0s before being sent.
 In the situation where the sender decides to
calculate the checksum, but it happens that
the result is all 0s, the checksum is
changed to all 1s before the packet is sent.
 In other words, the sender complements
the sum two times.
4/5/2022 Karpagam Institute of Technology 37
UDP SERVICES
Congestion Control
 Since UDP is a connectionless protocol, it
does not provide congestion control.
 UDP assumes that the packets sent are
small and sporadic(occasionally or at
irregular intervals) and cannot create
congestion in the network.
 This assumption may or may not be true,
when UDP is used for interactive real-time
transfer of audio and video.
4/5/2022 Karpagam Institute of Technology 38
UDP SERVICES
Encapsulation and Decapsulation
 To send a message from one process
to another, the UDP protocol
encapsulates and decapsulates
messages.
4/5/2022 Karpagam Institute of Technology 39
UDP SERVICES
Queuing
 In UDP, queues are associated with
ports.
 At the client site, when a process starts,
it requests a port number from the
operating system.
 Some implementations create both an
incoming and an outgoing queue
associated with each process.
 Other implementations create only an
incoming queue associated with each
process.
4/5/2022 Karpagam Institute of Technology 40
UDP SERVICES
Multiplexing and Demultiplexing
 In a host running a transport protocol
suite, there is only one UDP but
possibly several processes that may
want to use the services of UDP.
 To handle this situation, UDP
multiplexes and demultiplexes.
4/5/2022 Karpagam Institute of Technology 41
APPLICATIONS OF UDP
 UDP is used for management processes such as
SNMP.
 UDP is used for route updating protocols such as
RIP.
 UDP is a suitable transport protocol for
multicasting. Multicasting capability is embedded in
the UDP software
 UDP is suitable for a process with internal flow and
error control mechanisms such as Trivial File
Transfer Protocol (TFTP).
 UDP is suitable for a process that requires simple
request-response communication with little concern
for flow and error control.
 UDP is normally used for interactive real-time
applications that cannot tolerate uneven delay
4/5/2022 Karpagam Institute of Technology 42
The Transport Services
 The transport protocol should provide
to higher-level protocols.
 The transport entity that provides
services to transport service users,
which might be an application
process.
4/5/2022 Karpagam Institute of Technology 43
TRANSMISSION CONTROL
PROTOCOL (TCP)
 TCP is a reliable, connection-oriented, byte-stream
protocol.
 TCP guarantees the reliable, in-order delivery of a
stream of bytes. It is a full-duplex protocol, meaning that
each TCP connection supports a pair of byte streams,
one flowing in each direction.
 TCP includes a flow-control mechanism for each of
these byte streams that allow the receiver to limit how
much data the sender can transmit at a given time.
 TCP supports a demultiplexing mechanism that allows
multiple application programs on any given host to
simultaneously carry on a conversation with their peers.
 TCP also implements congestion-control mechanism.
The idea of this mechanism is to prevent sender from
overloading the network.
 Flow control is an end to end issue, whereas
congestion control is concerned with how host and
network interact. 4/5/2022 Karpagam Institute of Technology 44
TCP SERVICES
 Process-to-Process Communication
◦ TCP provides process-to-process communication
using port numbers.
 Stream Delivery Service
◦ TCP is a stream-oriented protocol.
◦ TCP allows the sending process to deliver data
as a stream of bytes and allows the receiving
process to obtain data as a stream of bytes.
◦ TCP creates an environment in which the two
processes seem to be connected by an
imaginary “tube” that carries their bytes across
the Internet.
◦ The sending process produces (writes to) the
stream and the receiving process consumes
(reads from) it. 4/5/2022 Karpagam Institute of Technology 45
Stream Delivery Service
4/5/2022 Karpagam Institute of Technology 46
Full-Duplex Communication
◦ TCP offers full-duplex service, where data
can flow in both directions at the same
time.
◦ Each TCP endpoint then has its own
sending and receiving buffer, and
segments move in both directions.
Multiplexing and Demultiplexing
 TCP performs multiplexing at the
sender and demultiplexing at the
receiver.
4/5/2022 Karpagam Institute of Technology 47
 Connection-Oriented Service
◦ TCP is a connection-oriented protocol.
◦ A connection needs to be established for
each pair of processes.
◦ When a process at site A wants to send to
and receive data from another process at
site B, the following three phases occur:
 The two TCP’s establish a logical
connection between them.
 Data are exchanged in both directions.
 The connection is terminated.
4/5/2022 Karpagam Institute of Technology 48
Reliable Service
◦ TCP is a reliable transport protocol.
◦ It uses an acknowledgment mechanism to
check the safe and sound arrival of data.
4/5/2022 Karpagam Institute of Technology 49
TCP SEGMENT
◦ A packet in TCP is called a segment.
◦ Data unit exchanged between TCP peers
are called segments.
◦ 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.

4/5/2022 Karpagam Institute of Technology 50
TCP SEGMENT
4/5/2022 Karpagam Institute of Technology 51
TCP SEGMENT
◦ TCP is a byte-oriented protocol, which means that the
sender writes bytes into a TCP connection and the
receiver reads bytes out of the TCP connection.
◦ TCP does not, itself, transmit individual bytes over the
Internet.
◦ TCP on the source host buffers enough bytes from
the sending process to fill a reasonably sized packet
and then sends this packet to its peer on the
destination host.
◦ TCP on the destination host then empties the
contents of the packet into a receive buffer, and the
receiving process reads from this buffer at its leisure.
◦ TCP connection supports byte streams flowing in
both directions.
◦ The packets exchanged between TCP peers are
called segments, since each one carries a segment of
the byte stream.
4/5/2022 Karpagam Institute of Technology 52
TCP PACKET FORMAT
◦ Each TCP segment contains the header
plus the data.
◦ The segment consists of a header of 20 to
60 bytes, followed by data from the
application program.
◦ The header is 20 bytes if there are no
options and up to 60 bytes if it contains
options.
4/5/2022 Karpagam Institute of Technology 53
TCP PACKET FORMAT
4/5/2022 Karpagam Institute of Technology 54
TCP CONNECTION
MANAGEMENT
◦ TCP is connection-oriented.
◦ A connection-oriented transport protocol
establishes a logical path between the
source and destination.
◦ All of the segments belonging to a
message are then sent over this logical
path.
◦ In TCP, connection-oriented transmission
requires three phases: Connection
Establishment, Data Transfer and
Connection Termination.
4/5/2022 Karpagam Institute of Technology 55
Connection Establishment
 While opening a TCP connection the
two nodes(client and server) want to
agree on a set of parameters.
 The parameters are the starting
sequence numbers that is to be used
for their respective byte streams.
 Connection establishment in TCP is a
three-way handshaking.
4/5/2022 Karpagam Institute of Technology 56
three-way handshaking
4/5/2022 Karpagam Institute of Technology 57
Connection Establishment
 Client sends a SYN segment to the
server containing its initial sequence
number (Flags
 = SYN, SequenceNum = x)
 Server responds with a segment that
acknowledges client’s segment and
specifies its initial sequence number
(Flags = SYN + ACK, ACK = x + 1
SequenceNum = y).
 Finally, client responds with a segment
that acknowledges server’s sequence
number 4/5/2022 Karpagam Institute of Technology 58
Data Transfer
◦ After connection is established,
bidirectional data transfer can take place.
◦ The client and server can send data and
acknowledgments in both directions.
◦ The data traveling in the same direction
as an acknowledgment are carried on the
same segment.
◦ The acknowledgment is piggybacked with
the data.
4/5/2022 Karpagam Institute of Technology 59
Connection Termination
 Connection termination or teardown
can be done in two ways :
 Three-way Close and Half-Close
 Three-way Close—Both client and
server close simultaneously.
4/5/2022 Karpagam Institute of Technology 60
4/5/2022 Karpagam Institute of Technology 61
STATE TRANSITION DIAGRAM
 To keep track of all the different events
happening during connection
establishment, connection termination,
and data transfer, TCP is specified as the
finite state machine (FSM).
 The transition from one state to another
is shown using directed lines.
 States involved in opening and closing a
connection is shown above and below
ESTABLISHED state respectively.
 States Involved in TCP :
4/5/2022 Karpagam Institute of Technology 62
STATE TRANSITION DIAGRAM
4/5/2022 Karpagam Institute of Technology 63
STATE TRANSITION DIAGRAM
4/5/2022 Karpagam Institute of Technology 64
TCP FLOW CONTROL
4/5/2022 Karpagam Institute of Technology 65
4/5/2022 Karpagam Institute of Technology 66
4/5/2022 Karpagam Institute of Technology 67
Flow Control in TCP
 Size of send and receive buffer is MaxSendBuffer
and MaxRcvBuffer respectively.
 Sending TCP prevents overflowing of send buffer
by maintaining
LastByteWritten − LastByteAcked ≤
MaxSendBuffer
 Receiving TCP avoids overflowing its receive buffer
by maintaining
LastByteRcvd − LastByteRead ≤ MaxRcvBuffer
 Receiver throttles the sender by having
AdvertisedWindow based on free space available
for buffering.
 AdvertisedWindow = MaxRcvBuffer −
((NextByteExpected − 1) – LastByteRead)
4/5/2022 Karpagam Institute of Technology 68
 Sending TCP adheres to AdvertisedWindow by
computing EffectiveWindow that
 limits how much data it should send.
 EffectiveWindow = AdvertisedWindow −
(LastByteSent − LastByteAcked)
 When data arrives, LastByteRcvd moves to its
right and AdvertisedWindow shrinks.
 Receiver acknowledges only, if preceding bytes
have arrived.
 AdvertisedWindow expands when data is read by
the application. o If data is read as fast as it
arrives then
 AdvertisedWindow = MaxRcvBuffer
 o If data is read slowly, it eventually leads to a
AdvertisedWindow of size 0.
 AdvertisedWindow field is designed to allow
sender to keep the pipe full.
4/5/2022 Karpagam Institute of Technology 69
TCP TRANSMISSION
 TCP has three mechanism to trigger
the transmission of a segment.
 They are
◦ Maximum Segment Size (MSS) - Silly
Window Syndrome
◦ Timeout - Nagle’s Algorithm
4/5/2022 Karpagam Institute of Technology 70
TCP CONGESTION CONTROL
 TCP Congestion Control mechanisms
are:
 Additive Increase / Multiplicative
Decrease (AIMD)
 Slow Start
 Fast Retransmit and Fast Recovery
4/5/2022 Karpagam Institute of Technology 71
Additive Increase /
Multiplicative Decrease (AIMD)
4/5/2022 Karpagam Institute of Technology 72
Slow Start
4/5/2022 Karpagam Institute of Technology 73
Fast Retransmit And Fast
Recovery
4/5/2022 Karpagam Institute of Technology 74
TCP CONGESTION AVOIDANCE
 Congestion avoidance mechanisms prevent
congestion before it actually occurs.
 These mechanisms predict when congestion
is about to happen and then to reduce the
rate at which hosts send data just before
packets start being discarded.
 TCP creates loss of packets in order to
determine bandwidth of the connection.
 Routers help the end nodes by intimating
when congestion is likely to occur.
 Congestion-avoidance mechanisms are:
◦ DEC bit - Destination Experiencing Congestion
Bit
◦ RED - Random Early Detection
4/5/2022 Karpagam Institute of Technology 75
The Transport Services
 The following categories of service are
useful for describing the transport
service.
Type of service
Quality of service
Data transfer
User interface
Connection management
Expedited delivery
Status reporting
Security
4/5/2022 Karpagam Institute of Technology 76
STREAM CONTROL
TRANSMISSION PROTOCOL
(SCTP)
 Stream Control Transmission Protocol
(SCTP) is a reliable, message-oriented
transport layer protocol.
 SCTP has mixed features of TCP and
UDP.
 SCTP maintains the message
boundaries and detects the lost data,
duplicate data as well as out-of-order
data.
 SCTP provides the Congestion control
as well as Flow control.
 SCTP is especially designed for internet
applications as well as multimedia
communication. 4/5/2022 Karpagam Institute of Technology 77
SCTP SERVICES
Process-to-Process Communication
 SCTP provides process-to-process
communication.
Multiple Streams
 SCTP allows multistream service in each
connection, which is called association
in SCTP terminology.
 If one of the streams is blocked, the
other streams can still deliver their data.
4/5/2022 Karpagam Institute of Technology 78
4/5/2022 Karpagam Institute of Technology 79
Multihoming
 An SCTP association supports
multihoming service.
 The sending and receiving host can
define multiple IP addresses in each
end for an association.
 In this fault-tolerant approach, when
one path fails, another interface can
be used for data delivery without
interruption.
4/5/2022 Karpagam Institute of Technology 80
Multihoming
4/5/2022 Karpagam Institute of Technology 81
Full-Duplex Communication
 SCTP offers full-duplex service, where data can
flow in both directions at the same time. Each
SCTP then has a sending and receiving buffer
and packets are sent in both directions.
Connection-Oriented Service
 SCTP is a connection-oriented protocol.
 In SCTP, a connection is called an association.
 If a client wants to send and receive message
from server , the steps are :
 Step1: The two SCTPs establish the connection
with each other.
 Step2: Once the connection is established, the
data gets exchanged in both the directions.
 Step3: Finally, the association is terminated.
4/5/2022 Karpagam Institute of Technology 82
 Reliable Service
 SCTP is a reliable transport protocol.
 It uses an acknowledgment
mechanism to check the safe and
sound arrival of data.
4/5/2022 Karpagam Institute of Technology 83
SCTP PACKET FORMAT
4/5/2022 Karpagam Institute of Technology 84
SCTP ASSOCIATION
 SCTP is a connection-oriented
protocol.
 A connection in SCTP is called an
association to emphasize
multihoming.
 SCTP Associations consists of three
phases:
 Association Establishment
 Data Transfer
 Association Termination
4/5/2022 Karpagam Institute of Technology 85
SCTP FLOW CONTROL
 Flow control in SCTP is similar to that
in TCP.
 Current SCTP implementations use a
byte-oriented window for flow control.
4/5/2022 Karpagam Institute of Technology 86
Receiver Site
 The receiver has one buffer (queue) and
three variables.
 The queue holds the received data chunks
that have not yet been read by the process.
 The first variable holds the last TSN received,
cumTSN.
 The second variable holds the available
buffer size; winsize.
 The third variable holds the last accumulative
acknowledgment, lastACK.
 The following figure shows the queue and
variables at the receiver site.
4/5/2022 Karpagam Institute of Technology 87
Receiver Site
4/5/2022 Karpagam Institute of Technology 88
Receiver Site
 When the site receives a data chunk, it stores it
at the end of the buffer (queue) and subtracts the
size of the chunk from winSize.
 The TSN number of the chunk is stored in the
cumTSN variable.
 When the process reads a chunk, it removes it
from the queue and adds the size of the removed
chunk to winSize (recycling).
 When the receiver decides to send a SACK, it
checks the value of lastAck; if it is less than
cumTSN, it sends a SACK with a cumulative
TSN number equal to the cumTSN.
 It also includes the value of winSize as the
advertised window size.
4/5/2022 Karpagam Institute of Technology 89
Sender Site
 The sender has one buffer (queue) and three variables:
curTSN, rwnd, and inTransit.
 We assume each chunk is 100 bytes long. The buffer
holds the chunks produced by the process that either
have been sent or are ready to be sent.
 The first variable, curTSN, refers to the next chunk to
be sent.
 All chunks in the queue with a TSN less than this value
have been sent, but not acknowledged; they are
outstanding.
 The second variable, rwnd, holds the last value
advertised by the receiver (in bytes).
 The third variable, inTransit, holds the number of bytes
in transit, bytes sent but not yet acknowledged.
 The following figure shows the queue and variables at
the sender site.
4/5/2022 Karpagam Institute of Technology 90
Sender Site
4/5/2022 Karpagam Institute of Technology 91
Sender Site
 A chunk pointed to by curTSN can be sent if the size of
the data is less than or equal to the quantity rwnd -
inTransit.
 After sending the chunk, the value of curTSN is
incremented by 1 and now points to the next chunk to
be sent.
 The value of inTransit is incremented by the size of the
data in the transmitted chunk.
 When a SACK is received, the chunks with a TSN less
than or equal to the cumulative TSN in the SACK are
removed from the queue and discarded. The sender
does not have to worry about them anymore.
 The value of inTransit is reduced by the total size of the
discarded chunks.
 The value of rwnd is updated with the value of the
advertised window in the SACK.
4/5/2022 Karpagam Institute of Technology 92
SCTP ERROR CONTROL
 SCTP is a reliable transport layer
protocol.
 It uses a SACK chunk to report the
state of the receiver buffer to the
sender.
 Each implementation uses a different
set of entities and timers for the
receiver and sender sites.
4/5/2022 Karpagam Institute of Technology 93
Receiver Site
 The receiver stores all chunks that have
arrived in its queue including the out-of-
order ones. However, it leaves spaces
for any missing chunks.
 It discards duplicate messages, but
keeps track of them for reports to the
sender.

The following figure shows a typical
design for the receiver site and the state
of the receiving queue at a particular
point in time.
4/5/2022 Karpagam Institute of Technology 94
Receiver Site
4/5/2022 Karpagam Institute of Technology 95
Receiver Site
 The available window size is 1000 bytes.
 The last acknowledgment sent was for data chunk
20.
 Chunks 21 to 23 have been received in order.
 The first out-of-order block contains chunks 26 to
28.
 The second out-of-order block contains chunks 31
to 34.
 A variable holds the value of cumTSN.
 An array of variables keeps track of the beginning
and the end of each block that is out of order.
 An array of variables holds the duplicate chunks
received.
 There is no need for storing duplicate chunks in the
queue and they will be discarded.
4/5/2022 Karpagam Institute of Technology 96
Sender Site
4/5/2022 Karpagam Institute of Technology 97
 The sending queue holds chunks 23 to 40.
 The chunks 23 to 36 have already been sent, but
not acknowledged; they are outstanding chunks.
 The curTSN points to the next chunk to be sent
(37).
 We assume that each chunk is 100 bytes, which
means that 1400 bytes of data (chunks 23 to 36)
is in transit.
 The sender at this moment has a retransmission
queue.
 When a packet is sent, a retransmission timer
starts for that packet (all data chunks in that
packet).
 Some implementations use one single timer for
the entire association, but other implementations
use one timer for each packet.
4/5/2022 Karpagam Institute of Technology 98
SCTP CONGESTION
CONTROL
 SCTP is a transport-layer protocol with
packets subject to congestion in the
network.
 The SCTP designers have used the
same strategies for congestion control
as those used in TCP.
4/5/2022 Karpagam Institute of Technology 99
THANK YOU
4/5/2022 Karpagam Institute of Technology 100

More Related Content

PDF
Cs8591 Computer Networks
PDF
CS8591 Computer Networks - Unit IV
PPT
Network layer tanenbaum
PPT
Routing algorithm network layer
PPT
Switching
PPTX
Network layer - design Issues
PPTX
Unit 4-Transport Layer Protocols.pptx
Cs8591 Computer Networks
CS8591 Computer Networks - Unit IV
Network layer tanenbaum
Routing algorithm network layer
Switching
Network layer - design Issues
Unit 4-Transport Layer Protocols.pptx

What's hot (20)

PPT
Unit 5 Application Layer
PDF
Cs8591 Computer Networks - UNIT V
PPT
Packet switching
PPTX
GO BACK N PROTOCOL
PPTX
Routing algorithms
PPTX
Session Layer
PPTX
Media Access Control
PDF
Interconnection Network
PPT
Transport layer (computer networks)
PPT
Application Layer
PPT
3.Medium Access Control
PDF
Admission control
PPT
Switching
PPT
PPTX
Unit 4 - Network Layer
PPTX
Flow control &amp; error control
PPT
Mac layer
PPTX
Quality of Service
PPTX
Sliding window protocol(ARQ technique)
PPT
Chapter 4 data link layer
Unit 5 Application Layer
Cs8591 Computer Networks - UNIT V
Packet switching
GO BACK N PROTOCOL
Routing algorithms
Session Layer
Media Access Control
Interconnection Network
Transport layer (computer networks)
Application Layer
3.Medium Access Control
Admission control
Switching
Unit 4 - Network Layer
Flow control &amp; error control
Mac layer
Quality of Service
Sliding window protocol(ARQ technique)
Chapter 4 data link layer
Ad

Similar to Unit 4 - Transport Layer (20)

PPTX
COMPUTER NETWORKS NOTES Unit 4
PPTX
CN UNIT IV ..pptx
PPTX
CN(BCS502) Module-4 _Transport Layer.pptx
PPTX
CN Unit 4 - cs8591.pptx
PPTX
Chapter Five - Transport Layer.pptx
PPTX
Understanding the Transport Layer: MUX, DEMUX, Process-to-Process Delivery, T...
PPTX
cCN UNIT4.pptxhomijo,k,ojik,m9uhgyh9ui,polo,0im
PPTX
VTU V SEM CNS Module 1 PPT 2018 Batch students
PPTX
Transport Layer Services : Multiplexing And Demultiplexing
PPTX
Module 2.pptx.............sdvsdcdssdfsdf
PPTX
PPTX
PPTX
Group 3 Presen.pptx
PPTX
07 coms 525 tcpip - udp [autosaved]
PPTX
TL services and multiplexing demultiplexing (3).pptx
PPTX
Unit 4.pptxenhdgjkslkxnjhjijnbhndnernjdxcndf
PPTX
Transport layer.pptx
PPTX
lecturer3.pptx
PPT
Network Models
PPTX
Chapter 3 final
COMPUTER NETWORKS NOTES Unit 4
CN UNIT IV ..pptx
CN(BCS502) Module-4 _Transport Layer.pptx
CN Unit 4 - cs8591.pptx
Chapter Five - Transport Layer.pptx
Understanding the Transport Layer: MUX, DEMUX, Process-to-Process Delivery, T...
cCN UNIT4.pptxhomijo,k,ojik,m9uhgyh9ui,polo,0im
VTU V SEM CNS Module 1 PPT 2018 Batch students
Transport Layer Services : Multiplexing And Demultiplexing
Module 2.pptx.............sdvsdcdssdfsdf
Group 3 Presen.pptx
07 coms 525 tcpip - udp [autosaved]
TL services and multiplexing demultiplexing (3).pptx
Unit 4.pptxenhdgjkslkxnjhjijnbhndnernjdxcndf
Transport layer.pptx
lecturer3.pptx
Network Models
Chapter 3 final
Ad

Recently uploaded (20)

PDF
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PPTX
Current and future trends in Computer Vision.pptx
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PPTX
Information Storage and Retrieval Techniques Unit III
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PPTX
Module 8- Technological and Communication Skills.pptx
PPTX
Feature types and data preprocessing steps
PDF
COURSE DESCRIPTOR OF SURVEYING R24 SYLLABUS
PPTX
Fundamentals of Mechanical Engineering.pptx
PDF
Abrasive, erosive and cavitation wear.pdf
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PDF
August 2025 - Top 10 Read Articles in Network Security & Its Applications
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PDF
Soil Improvement Techniques Note - Rabbi
PPTX
Nature of X-rays, X- Ray Equipment, Fluoroscopy
PPT
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
PPTX
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
Automation-in-Manufacturing-Chapter-Introduction.pdf
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
Current and future trends in Computer Vision.pptx
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
Information Storage and Retrieval Techniques Unit III
Exploratory_Data_Analysis_Fundamentals.pdf
Module 8- Technological and Communication Skills.pptx
Feature types and data preprocessing steps
COURSE DESCRIPTOR OF SURVEYING R24 SYLLABUS
Fundamentals of Mechanical Engineering.pptx
Abrasive, erosive and cavitation wear.pdf
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
August 2025 - Top 10 Read Articles in Network Security & Its Applications
Categorization of Factors Affecting Classification Algorithms Selection
Soil Improvement Techniques Note - Rabbi
Nature of X-rays, X- Ray Equipment, Fluoroscopy
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
CURRICULAM DESIGN engineering FOR CSE 2025.pptx

Unit 4 - Transport Layer

  • 1. KARPAGAM INSTITUTE OF TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Course Code with Name :CS8591/Computer Networks Staff Name / Designation : Mrs.C.Kalpana / AP Department : CSE Year/Semester : III/V 1 Karpagam Institute of Technology 4/5/2022
  • 2. UNIT – IV TRANSPORT LAYER 4/5/2022 Karpagam Institute of Technology 2 Introduction – Transport Layer Protocols – Services – Port Numbers – User Datagram Protocol – Transmission Control Protocol – SCTP.
  • 3. INTRODUCTION  The transport layer is the fourth layer of the OSI model and is the core of the Internet model.  It responds to service requests from the session layer and issues service requests to the network Layer.  The transport layer provides transparent transfer of data between hosts.  It provides end-to-end control and information transfer with the quality of service needed by the application program.  It is the first true end-to-end layer, implemented in all End Systems (ES). 4/5/2022 Karpagam Institute of Technology 3
  • 4. 4/5/2022 Karpagam Institute of Technology 4
  • 5. 4/5/2022 Karpagam Institute of Technology 5
  • 6. TRANSPORT LAYER FUNCTIONS / SERVICES  The transport layer is located between the network layer and the application layer.  The transport layer is responsible for providing services to the application layer; it receives services from the network layer. 4/5/2022 Karpagam Institute of Technology 6
  • 7. TRANSPORT LAYER FUNCTIONS / SERVICES  The services that can be provided by the transport layer are 1. Process-to-Process Communication 2. Addressing : Port Numbers 3. Encapsulation and Decapsulation 4. Multiplexing and Demultiplexing 5. Flow Control 6. Error Control 7. Congestion Control 4/5/2022 Karpagam Institute of Technology 7
  • 8. Process-to-Process Communication  The Transport Layer is responsible for delivering data to the appropriate application process on the host computers.  This involves multiplexing of data from different application processes, i.e. forming data packets, and adding source and destination port numbers in the header of each Transport Layer data packet.  Together with the source and destination IP address, the port numbers constitutes a network socket, i.e. an identification address of the process-to-process 4/5/2022 Karpagam Institute of Technology 8
  • 9. Addressing: Port Numbers  Ports are the essential ways to address multiple entities in the same location.  Using port addressing it is possible to use more than one network-based application at the same time.  Three types of Port numbers are used : Well-known ports - These are permanent port numbers. They range between 0 to 1023.These port numbers are used by Server Process. Registered ports - The ports ranging from 1024 to 49,151 are not assigned or controlled. Ephemeral ports (Dynamic Ports) – These are temporary port numbers. They range between 49152–65535.These port numbers are used by Client Process. 4/5/2022 Karpagam Institute of Technology 9
  • 10. Encapsulation and Decapsulation  To send a message from one process to another, the transport-layer protocol encapsulates and decapsulates messages.  Encapsulation happens at the sender site. The transport layer receives the data and adds the transport-layer header.  Decapsulation happens at the receiver site. When the message arrives at the destination transport layer, the header is dropped and the transport layer delivers the message to the process running at the application layer. 4/5/2022 Karpagam Institute of Technology 10
  • 11. Multiplexing and Demultiplexing  Whenever an entity accepts items from more than one source, this is referred to as multiplexing (many to one).  Whenever an entity delivers items to more than one source, this is referred to as demultiplexing (one to many).  The transport layer at the source performs multiplexing  The transport layer at the destination performs demultiplexing 4/5/2022 Karpagam Institute of Technology 11
  • 12. Flow Control  Flow Control is the process of managing the rate of data transmission between two nodes to prevent a fast sender from overwhelming a slow receiver.  It provides a mechanism for the receiver to control the transmission speed, so that the receiving node is not overwhelmed with data from transmitting node. 4/5/2022 Karpagam Institute of Technology 12
  • 13. Flow Control 4/5/2022 Karpagam Institute of Technology 13
  • 14. Error Control  Error control at the transport layer is responsible for 1. Detecting and discarding corrupted packets. 2. Keeping track of lost and discarded packets and resending them. 3. Recognizing duplicate packets and discarding them. 4. Buffering out-of-order packets until the missing packets arrive.  Error Control involves Error Detection and Error Correction 4/5/2022 Karpagam Institute of Technology 14
  • 15. Error Control 4/5/2022 Karpagam Institute of Technology 15
  • 16. Congestion Control  Congestion in a network may occur if the load on the network (the number of packets sent to the network) is greater than the capacity of the network (the number of packets a network can handle).  Congestion control refers to the mechanisms and techniques that control the congestion and keep the load below the capacity.  Congestion Control refers to techniques and mechanisms that can either prevent congestion, before it happens, or remove congestion, after it has happened  Congestion control mechanisms are divided into two categories, 1. Open loop - prevent the congestion before it happens. 4/5/2022 Karpagam Institute of Technology 16
  • 17. PORT NUMBERS  A transport-layer protocol usually has several responsibilities.  One is to create a process-to-process communication.  Processes are programs that run on hosts. It could be either server or client.  A process on the local host, called a client, needs services from a process usually on the remote host, called a server.  Processes are assigned a unique 16-bit port number on that host.  Port numbers provide end-to-end addresses at the transport layer  They also provide multiplexing and demultiplexing at this layer. 4/5/2022 Karpagam Institute of Technology 17
  • 18. PORT NUMBERS 4/5/2022 Karpagam Institute of Technology 18
  • 19.  ICANN (Internet Corporation for Assigned Names and Numbers) has divided the port numbers into three ranges: ◦ Well-known ports ◦ Registered ◦ Ephemeral ports (Dynamic Ports) 4/5/2022 Karpagam Institute of Technology 19
  • 20. WELL-KNOWN PORTS  These are permanent port numbers used by the servers.  They range between 0 to 1023.  This port number cannot be chosen randomly.  These port numbers are universal port numbers for servers.  Every client process knows the well-known port number of the corresponding server process.  For example, while the daytime client process, a well-known client program, can use an ephemeral (temporary) port number, 52,000, to identify itself, the daytime server process must use the well-known 4/5/2022 Karpagam Institute of Technology 20
  • 21. WELL-KNOWN PORTS 4/5/2022 Karpagam Institute of Technology 21
  • 22. EPHEMERAL PORTS (DYNAMIC PORTS)  The client program defines itself with a port number, called the ephemeral port number.  The word ephemeral means “short-lived” and is used because the life of a client is normally short.  An ephemeral port number is recommended to be greater than 1023.  These port number ranges from 49,152 to 65,535  They are neither controlled nor registered. They can be used as temporary or private port numbers. 4/5/2022 Karpagam Institute of Technology 22
  • 23. REGISTERED PORTS  The ports ranging from 1024 to 49,151 are not assigned or controlled. 4/5/2022 Karpagam Institute of Technology 23
  • 24. TRANSPORT LAYER PROTOCOLS  Three protocols are associated with the Transport layer.  They are (1) UDP –User Datagram Protocol (2) TCP – Transmission Control Protocol (3) SCTP - Stream Control Transmission Protocol  Each protocol provides a different type of service and should be used appropriately. 4/5/2022 Karpagam Institute of Technology 24
  • 25.  UDP - UDP is an unreliable connectionless transport-layer protocol used for its simplicity and efficiency in applications where error control can be provided by the application-layer process.  TCP - TCP is a reliable connection-oriented protocol that can be used in any application where reliability is important.  SCTP - SCTP is a new transport-layer protocol designed to combine some features of UDP and TCP in an effort to create a better protocol for multimedia communication. 4/5/2022 Karpagam Institute of Technology 25
  • 26. USER DATAGRAM PROTOCOL (UDP)  User Datagram Protocol (UDP) is a connectionless, unreliable transport protocol.  UDP adds process-to-process communication to best- effort service provided by IP.  UDP is a very simple protocol using a minimum of overhead.  UDP is a simple demultiplexer, which allows multiple processes on each host to communicate.  UDP does not provide flow control , reliable or ordered delivery.  UDP can be used to send small message where reliability is not expected.  Sending a small message using UDP takes much less interaction between the sender and receiver.  UDP allow processes to indirectly identify each other using an abstract locator called port or mailbox 4/5/2022 Karpagam Institute of Technology 26
  • 27. UDP PORTS  Processes (server/client) are identified by an abstract locator known as port.  Server accepts message at well known port.  Some well-known UDP ports are 7–Echo, 53–DNS, 111–RPC, 161–SNMP, etc.  < port, host > pair is used as key for demultiplexing.  Ports are implemented as a message queue.  When a message arrives, UDP appends it to end of the queue.  When queue is full, the message is discarded.  When a message is read, it is removed from the queue.  When an application process wants to receive a message, one is removed from the front of the queue.  If the queue is empty, the process blocks until a message becomes available. 4/5/2022 Karpagam Institute of Technology 27
  • 28. 4/5/2022 Karpagam Institute of Technology 28
  • 29. UDP DATAGRAM (PACKET) FORMAT  UDP packets are known as user datagrams .  These user datagrams, have a fixed-size header of 8 bytes made of four fields, each of 2 bytes (16 bits). 4/5/2022 Karpagam Institute of Technology 29
  • 30. Source Port Number  Port number used by process on source host with 16 bits long.  If the source host is client (sending request) then the port number is an temporary one requested by the process and chosen by UDP.  If the source is server (sending response) then it is well known port number. Destination Port Number  Port number used by process on Destination host with 16 bits long.  If the destination host is the server (a client sending request) then the port number is a well known port number.  If the destination host is client (a server sending response) then port number is an temporary one copied by server from the request packet. 4/5/2022 Karpagam Institute of Technology 30
  • 31. Length  This field denotes the total length of the UDP Packet (Header plus data)  The total length of any UDP datagram can be from 0 to 65,535 bytes. Checksum  UDP computes its checksum over the UDP header, the contents of the message body, and something called the pseudoheader.  The pseudoheader consists of three fields from the IP header—protocol number, source IP address, destination IP address plus the UDP length field. Data  Data field defines tha actual payload to be transmitted.  Its size is variable. 4/5/2022 Karpagam Institute of Technology 31
  • 32. UDP SERVICES Process-to-Process Communication  UDP provides process-to-process communication using socket addresses, a combination of IP addresses and port numbers. 4/5/2022 Karpagam Institute of Technology 32
  • 33. UDP SERVICES Connectionless Services  UDP provides a connectionless service.  There is no connection establishment and no connection termination .  Each user datagram sent by UDP is an independent datagram.  There is no relationship between the different user datagrams even if they are coming from the same source process and going to the same destination program.  The user datagrams are not numbered.  Each user datagram can travel on a different path. 4/5/2022 Karpagam Institute of Technology 33
  • 34. UDP SERVICES Flow Control  UDP is a very simple protocol.  There is no flow control, and hence no window mechanism.  The receiver may overflow with incoming messages.  The lack of flow control means that the process using UDP should provide for this service, if needed. 4/5/2022 Karpagam Institute of Technology 34
  • 35. UDP SERVICES Error Control  There is no error control mechanism in UDP except for the checksum.  This means that the sender does not know if a message has been lost or duplicated.  When the receiver detects an error through the checksum, the user datagram is silently discarded.  The lack of error control means that the process using UDP should provide for this service, if needed. 4/5/2022 Karpagam Institute of Technology 35
  • 36. UDP SERVICES Checksum  UDP checksum calculation includes three sections: a pseudoheader, the UDP header, and the data coming from the application layer.  The pseudoheader is the part of the header in which the user datagram is to be encapsulated with some fields filled with 0s. 4/5/2022 Karpagam Institute of Technology 36
  • 37. UDP SERVICES Optional Inclusion of Checksum  The sender of a UDP packet can choose not to calculate the checksum.  In this case, the checksum field is filled with all 0s before being sent.  In the situation where the sender decides to calculate the checksum, but it happens that the result is all 0s, the checksum is changed to all 1s before the packet is sent.  In other words, the sender complements the sum two times. 4/5/2022 Karpagam Institute of Technology 37
  • 38. UDP SERVICES Congestion Control  Since UDP is a connectionless protocol, it does not provide congestion control.  UDP assumes that the packets sent are small and sporadic(occasionally or at irregular intervals) and cannot create congestion in the network.  This assumption may or may not be true, when UDP is used for interactive real-time transfer of audio and video. 4/5/2022 Karpagam Institute of Technology 38
  • 39. UDP SERVICES Encapsulation and Decapsulation  To send a message from one process to another, the UDP protocol encapsulates and decapsulates messages. 4/5/2022 Karpagam Institute of Technology 39
  • 40. UDP SERVICES Queuing  In UDP, queues are associated with ports.  At the client site, when a process starts, it requests a port number from the operating system.  Some implementations create both an incoming and an outgoing queue associated with each process.  Other implementations create only an incoming queue associated with each process. 4/5/2022 Karpagam Institute of Technology 40
  • 41. UDP SERVICES Multiplexing and Demultiplexing  In a host running a transport protocol suite, there is only one UDP but possibly several processes that may want to use the services of UDP.  To handle this situation, UDP multiplexes and demultiplexes. 4/5/2022 Karpagam Institute of Technology 41
  • 42. APPLICATIONS OF UDP  UDP is used for management processes such as SNMP.  UDP is used for route updating protocols such as RIP.  UDP is a suitable transport protocol for multicasting. Multicasting capability is embedded in the UDP software  UDP is suitable for a process with internal flow and error control mechanisms such as Trivial File Transfer Protocol (TFTP).  UDP is suitable for a process that requires simple request-response communication with little concern for flow and error control.  UDP is normally used for interactive real-time applications that cannot tolerate uneven delay 4/5/2022 Karpagam Institute of Technology 42
  • 43. The Transport Services  The transport protocol should provide to higher-level protocols.  The transport entity that provides services to transport service users, which might be an application process. 4/5/2022 Karpagam Institute of Technology 43
  • 44. TRANSMISSION CONTROL PROTOCOL (TCP)  TCP is a reliable, connection-oriented, byte-stream protocol.  TCP guarantees the reliable, in-order delivery of a stream of bytes. It is a full-duplex protocol, meaning that each TCP connection supports a pair of byte streams, one flowing in each direction.  TCP includes a flow-control mechanism for each of these byte streams that allow the receiver to limit how much data the sender can transmit at a given time.  TCP supports a demultiplexing mechanism that allows multiple application programs on any given host to simultaneously carry on a conversation with their peers.  TCP also implements congestion-control mechanism. The idea of this mechanism is to prevent sender from overloading the network.  Flow control is an end to end issue, whereas congestion control is concerned with how host and network interact. 4/5/2022 Karpagam Institute of Technology 44
  • 45. TCP SERVICES  Process-to-Process Communication ◦ TCP provides process-to-process communication using port numbers.  Stream Delivery Service ◦ TCP is a stream-oriented protocol. ◦ TCP allows the sending process to deliver data as a stream of bytes and allows the receiving process to obtain data as a stream of bytes. ◦ TCP creates an environment in which the two processes seem to be connected by an imaginary “tube” that carries their bytes across the Internet. ◦ The sending process produces (writes to) the stream and the receiving process consumes (reads from) it. 4/5/2022 Karpagam Institute of Technology 45
  • 46. Stream Delivery Service 4/5/2022 Karpagam Institute of Technology 46
  • 47. Full-Duplex Communication ◦ TCP offers full-duplex service, where data can flow in both directions at the same time. ◦ Each TCP endpoint then has its own sending and receiving buffer, and segments move in both directions. Multiplexing and Demultiplexing  TCP performs multiplexing at the sender and demultiplexing at the receiver. 4/5/2022 Karpagam Institute of Technology 47
  • 48.  Connection-Oriented Service ◦ TCP is a connection-oriented protocol. ◦ A connection needs to be established for each pair of processes. ◦ When a process at site A wants to send to and receive data from another process at site B, the following three phases occur:  The two TCP’s establish a logical connection between them.  Data are exchanged in both directions.  The connection is terminated. 4/5/2022 Karpagam Institute of Technology 48
  • 49. Reliable Service ◦ TCP is a reliable transport protocol. ◦ It uses an acknowledgment mechanism to check the safe and sound arrival of data. 4/5/2022 Karpagam Institute of Technology 49
  • 50. TCP SEGMENT ◦ A packet in TCP is called a segment. ◦ Data unit exchanged between TCP peers are called segments. ◦ 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.  4/5/2022 Karpagam Institute of Technology 50
  • 51. TCP SEGMENT 4/5/2022 Karpagam Institute of Technology 51
  • 52. TCP SEGMENT ◦ TCP is a byte-oriented protocol, which means that the sender writes bytes into a TCP connection and the receiver reads bytes out of the TCP connection. ◦ TCP does not, itself, transmit individual bytes over the Internet. ◦ TCP on the source host buffers enough bytes from the sending process to fill a reasonably sized packet and then sends this packet to its peer on the destination host. ◦ TCP on the destination host then empties the contents of the packet into a receive buffer, and the receiving process reads from this buffer at its leisure. ◦ TCP connection supports byte streams flowing in both directions. ◦ The packets exchanged between TCP peers are called segments, since each one carries a segment of the byte stream. 4/5/2022 Karpagam Institute of Technology 52
  • 53. TCP PACKET FORMAT ◦ Each TCP segment contains the header plus the data. ◦ The segment consists of a header of 20 to 60 bytes, followed by data from the application program. ◦ The header is 20 bytes if there are no options and up to 60 bytes if it contains options. 4/5/2022 Karpagam Institute of Technology 53
  • 54. TCP PACKET FORMAT 4/5/2022 Karpagam Institute of Technology 54
  • 55. TCP CONNECTION MANAGEMENT ◦ TCP is connection-oriented. ◦ A connection-oriented transport protocol establishes a logical path between the source and destination. ◦ All of the segments belonging to a message are then sent over this logical path. ◦ In TCP, connection-oriented transmission requires three phases: Connection Establishment, Data Transfer and Connection Termination. 4/5/2022 Karpagam Institute of Technology 55
  • 56. Connection Establishment  While opening a TCP connection the two nodes(client and server) want to agree on a set of parameters.  The parameters are the starting sequence numbers that is to be used for their respective byte streams.  Connection establishment in TCP is a three-way handshaking. 4/5/2022 Karpagam Institute of Technology 56
  • 57. three-way handshaking 4/5/2022 Karpagam Institute of Technology 57
  • 58. Connection Establishment  Client sends a SYN segment to the server containing its initial sequence number (Flags  = SYN, SequenceNum = x)  Server responds with a segment that acknowledges client’s segment and specifies its initial sequence number (Flags = SYN + ACK, ACK = x + 1 SequenceNum = y).  Finally, client responds with a segment that acknowledges server’s sequence number 4/5/2022 Karpagam Institute of Technology 58
  • 59. Data Transfer ◦ After connection is established, bidirectional data transfer can take place. ◦ The client and server can send data and acknowledgments in both directions. ◦ The data traveling in the same direction as an acknowledgment are carried on the same segment. ◦ The acknowledgment is piggybacked with the data. 4/5/2022 Karpagam Institute of Technology 59
  • 60. Connection Termination  Connection termination or teardown can be done in two ways :  Three-way Close and Half-Close  Three-way Close—Both client and server close simultaneously. 4/5/2022 Karpagam Institute of Technology 60
  • 61. 4/5/2022 Karpagam Institute of Technology 61
  • 62. STATE TRANSITION DIAGRAM  To keep track of all the different events happening during connection establishment, connection termination, and data transfer, TCP is specified as the finite state machine (FSM).  The transition from one state to another is shown using directed lines.  States involved in opening and closing a connection is shown above and below ESTABLISHED state respectively.  States Involved in TCP : 4/5/2022 Karpagam Institute of Technology 62
  • 63. STATE TRANSITION DIAGRAM 4/5/2022 Karpagam Institute of Technology 63
  • 64. STATE TRANSITION DIAGRAM 4/5/2022 Karpagam Institute of Technology 64
  • 65. TCP FLOW CONTROL 4/5/2022 Karpagam Institute of Technology 65
  • 66. 4/5/2022 Karpagam Institute of Technology 66
  • 67. 4/5/2022 Karpagam Institute of Technology 67
  • 68. Flow Control in TCP  Size of send and receive buffer is MaxSendBuffer and MaxRcvBuffer respectively.  Sending TCP prevents overflowing of send buffer by maintaining LastByteWritten − LastByteAcked ≤ MaxSendBuffer  Receiving TCP avoids overflowing its receive buffer by maintaining LastByteRcvd − LastByteRead ≤ MaxRcvBuffer  Receiver throttles the sender by having AdvertisedWindow based on free space available for buffering.  AdvertisedWindow = MaxRcvBuffer − ((NextByteExpected − 1) – LastByteRead) 4/5/2022 Karpagam Institute of Technology 68
  • 69.  Sending TCP adheres to AdvertisedWindow by computing EffectiveWindow that  limits how much data it should send.  EffectiveWindow = AdvertisedWindow − (LastByteSent − LastByteAcked)  When data arrives, LastByteRcvd moves to its right and AdvertisedWindow shrinks.  Receiver acknowledges only, if preceding bytes have arrived.  AdvertisedWindow expands when data is read by the application. o If data is read as fast as it arrives then  AdvertisedWindow = MaxRcvBuffer  o If data is read slowly, it eventually leads to a AdvertisedWindow of size 0.  AdvertisedWindow field is designed to allow sender to keep the pipe full. 4/5/2022 Karpagam Institute of Technology 69
  • 70. TCP TRANSMISSION  TCP has three mechanism to trigger the transmission of a segment.  They are ◦ Maximum Segment Size (MSS) - Silly Window Syndrome ◦ Timeout - Nagle’s Algorithm 4/5/2022 Karpagam Institute of Technology 70
  • 71. TCP CONGESTION CONTROL  TCP Congestion Control mechanisms are:  Additive Increase / Multiplicative Decrease (AIMD)  Slow Start  Fast Retransmit and Fast Recovery 4/5/2022 Karpagam Institute of Technology 71
  • 72. Additive Increase / Multiplicative Decrease (AIMD) 4/5/2022 Karpagam Institute of Technology 72
  • 73. Slow Start 4/5/2022 Karpagam Institute of Technology 73
  • 74. Fast Retransmit And Fast Recovery 4/5/2022 Karpagam Institute of Technology 74
  • 75. TCP CONGESTION AVOIDANCE  Congestion avoidance mechanisms prevent congestion before it actually occurs.  These mechanisms predict when congestion is about to happen and then to reduce the rate at which hosts send data just before packets start being discarded.  TCP creates loss of packets in order to determine bandwidth of the connection.  Routers help the end nodes by intimating when congestion is likely to occur.  Congestion-avoidance mechanisms are: ◦ DEC bit - Destination Experiencing Congestion Bit ◦ RED - Random Early Detection 4/5/2022 Karpagam Institute of Technology 75
  • 76. The Transport Services  The following categories of service are useful for describing the transport service. Type of service Quality of service Data transfer User interface Connection management Expedited delivery Status reporting Security 4/5/2022 Karpagam Institute of Technology 76
  • 77. STREAM CONTROL TRANSMISSION PROTOCOL (SCTP)  Stream Control Transmission Protocol (SCTP) is a reliable, message-oriented transport layer protocol.  SCTP has mixed features of TCP and UDP.  SCTP maintains the message boundaries and detects the lost data, duplicate data as well as out-of-order data.  SCTP provides the Congestion control as well as Flow control.  SCTP is especially designed for internet applications as well as multimedia communication. 4/5/2022 Karpagam Institute of Technology 77
  • 78. SCTP SERVICES Process-to-Process Communication  SCTP provides process-to-process communication. Multiple Streams  SCTP allows multistream service in each connection, which is called association in SCTP terminology.  If one of the streams is blocked, the other streams can still deliver their data. 4/5/2022 Karpagam Institute of Technology 78
  • 79. 4/5/2022 Karpagam Institute of Technology 79
  • 80. Multihoming  An SCTP association supports multihoming service.  The sending and receiving host can define multiple IP addresses in each end for an association.  In this fault-tolerant approach, when one path fails, another interface can be used for data delivery without interruption. 4/5/2022 Karpagam Institute of Technology 80
  • 82. Full-Duplex Communication  SCTP offers full-duplex service, where data can flow in both directions at the same time. Each SCTP then has a sending and receiving buffer and packets are sent in both directions. Connection-Oriented Service  SCTP is a connection-oriented protocol.  In SCTP, a connection is called an association.  If a client wants to send and receive message from server , the steps are :  Step1: The two SCTPs establish the connection with each other.  Step2: Once the connection is established, the data gets exchanged in both the directions.  Step3: Finally, the association is terminated. 4/5/2022 Karpagam Institute of Technology 82
  • 83.  Reliable Service  SCTP is a reliable transport protocol.  It uses an acknowledgment mechanism to check the safe and sound arrival of data. 4/5/2022 Karpagam Institute of Technology 83
  • 84. SCTP PACKET FORMAT 4/5/2022 Karpagam Institute of Technology 84
  • 85. SCTP ASSOCIATION  SCTP is a connection-oriented protocol.  A connection in SCTP is called an association to emphasize multihoming.  SCTP Associations consists of three phases:  Association Establishment  Data Transfer  Association Termination 4/5/2022 Karpagam Institute of Technology 85
  • 86. SCTP FLOW CONTROL  Flow control in SCTP is similar to that in TCP.  Current SCTP implementations use a byte-oriented window for flow control. 4/5/2022 Karpagam Institute of Technology 86
  • 87. Receiver Site  The receiver has one buffer (queue) and three variables.  The queue holds the received data chunks that have not yet been read by the process.  The first variable holds the last TSN received, cumTSN.  The second variable holds the available buffer size; winsize.  The third variable holds the last accumulative acknowledgment, lastACK.  The following figure shows the queue and variables at the receiver site. 4/5/2022 Karpagam Institute of Technology 87
  • 88. Receiver Site 4/5/2022 Karpagam Institute of Technology 88
  • 89. Receiver Site  When the site receives a data chunk, it stores it at the end of the buffer (queue) and subtracts the size of the chunk from winSize.  The TSN number of the chunk is stored in the cumTSN variable.  When the process reads a chunk, it removes it from the queue and adds the size of the removed chunk to winSize (recycling).  When the receiver decides to send a SACK, it checks the value of lastAck; if it is less than cumTSN, it sends a SACK with a cumulative TSN number equal to the cumTSN.  It also includes the value of winSize as the advertised window size. 4/5/2022 Karpagam Institute of Technology 89
  • 90. Sender Site  The sender has one buffer (queue) and three variables: curTSN, rwnd, and inTransit.  We assume each chunk is 100 bytes long. The buffer holds the chunks produced by the process that either have been sent or are ready to be sent.  The first variable, curTSN, refers to the next chunk to be sent.  All chunks in the queue with a TSN less than this value have been sent, but not acknowledged; they are outstanding.  The second variable, rwnd, holds the last value advertised by the receiver (in bytes).  The third variable, inTransit, holds the number of bytes in transit, bytes sent but not yet acknowledged.  The following figure shows the queue and variables at the sender site. 4/5/2022 Karpagam Institute of Technology 90
  • 91. Sender Site 4/5/2022 Karpagam Institute of Technology 91
  • 92. Sender Site  A chunk pointed to by curTSN can be sent if the size of the data is less than or equal to the quantity rwnd - inTransit.  After sending the chunk, the value of curTSN is incremented by 1 and now points to the next chunk to be sent.  The value of inTransit is incremented by the size of the data in the transmitted chunk.  When a SACK is received, the chunks with a TSN less than or equal to the cumulative TSN in the SACK are removed from the queue and discarded. The sender does not have to worry about them anymore.  The value of inTransit is reduced by the total size of the discarded chunks.  The value of rwnd is updated with the value of the advertised window in the SACK. 4/5/2022 Karpagam Institute of Technology 92
  • 93. SCTP ERROR CONTROL  SCTP is a reliable transport layer protocol.  It uses a SACK chunk to report the state of the receiver buffer to the sender.  Each implementation uses a different set of entities and timers for the receiver and sender sites. 4/5/2022 Karpagam Institute of Technology 93
  • 94. Receiver Site  The receiver stores all chunks that have arrived in its queue including the out-of- order ones. However, it leaves spaces for any missing chunks.  It discards duplicate messages, but keeps track of them for reports to the sender.  The following figure shows a typical design for the receiver site and the state of the receiving queue at a particular point in time. 4/5/2022 Karpagam Institute of Technology 94
  • 95. Receiver Site 4/5/2022 Karpagam Institute of Technology 95
  • 96. Receiver Site  The available window size is 1000 bytes.  The last acknowledgment sent was for data chunk 20.  Chunks 21 to 23 have been received in order.  The first out-of-order block contains chunks 26 to 28.  The second out-of-order block contains chunks 31 to 34.  A variable holds the value of cumTSN.  An array of variables keeps track of the beginning and the end of each block that is out of order.  An array of variables holds the duplicate chunks received.  There is no need for storing duplicate chunks in the queue and they will be discarded. 4/5/2022 Karpagam Institute of Technology 96
  • 97. Sender Site 4/5/2022 Karpagam Institute of Technology 97
  • 98.  The sending queue holds chunks 23 to 40.  The chunks 23 to 36 have already been sent, but not acknowledged; they are outstanding chunks.  The curTSN points to the next chunk to be sent (37).  We assume that each chunk is 100 bytes, which means that 1400 bytes of data (chunks 23 to 36) is in transit.  The sender at this moment has a retransmission queue.  When a packet is sent, a retransmission timer starts for that packet (all data chunks in that packet).  Some implementations use one single timer for the entire association, but other implementations use one timer for each packet. 4/5/2022 Karpagam Institute of Technology 98
  • 99. SCTP CONGESTION CONTROL  SCTP is a transport-layer protocol with packets subject to congestion in the network.  The SCTP designers have used the same strategies for congestion control as those used in TCP. 4/5/2022 Karpagam Institute of Technology 99
  • 100. THANK YOU 4/5/2022 Karpagam Institute of Technology 100