0% found this document useful (0 votes)
20 views13 pages

Unit V Part-1 Transport Layer Services

Uploaded by

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

Unit V Part-1 Transport Layer Services

Uploaded by

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

Transport Layer Services: TCP, UDP, SCTP

The transport layer is 4thLayer of the OSI reference model. It is


responsible for ensuring that the data packets arrive accurate and reliable
between sender and receiver. The transport layer most often uses TCP
(or)UDP.
 In the OSI model, the transport layer is placed between the network
layer and the session layer.
 The network layer is responsible for taking the data packets and sending
them to the correct computer.
 The transport layer then takes the received packets, checks them for
errors and sorts them. Then, it sends them to the session layer of the
correct program running on the computer.
 The unit of data encapsulation in the Transport Layer is a segment.

Working of Transport Layer: -

The transport layer takes services from the Application layer and provides
services to the Network layer.
At the sender’s side:
The transport layer receives data (message) from the Application
layer and then performs Segmentation, divides the actual message into
segments, adds the source and destination’s port numbers into the header
of the segment, and transfers the message to the Network layer.

At the receiver’s side: The transport layer receives data from the
Network layer, reassembles the segmented data, reads its header,
identifies the port number, and forwards the message to the appropriate
port in the Application layer.
Transport Layer Protocols: -
 There are two common protocols in transport layer
 UDP
 TCP
 UDP is a simple and fast transport protocol. It is for connectionless
transmissions. It is considered unreliable because it does not use
acknowledgements or retransmissions, so packets may be lost. UDP is
best for real-time data where speed of delivery is more important than
reliability, such as for video conferencing.
 TCP is the more feature-rich transport protocol. It is connection-oriented.
It uses synchronization and acknowledgement messages to ensure
delivery. It retransmits and reorders packets if needed. It can negotiate
sending and receiving rates. TCP is slower than UDP. TCP is the most
common protocol on the internet.
I. Services /Responsibilties of Transport Layer:-
The transport layer is responsible for providing services to the
application layer. It receives services from the network layer. They are

1. Full duplex communication 5. Stream delivery service


2. Connection oriented service 6. Segments
3. Reliable service 7. Flow control
4. Process to Process 8. Error control
Communications 9. Guarantee delivery
1.Full Duplex Communication: -
TCP is full duplex communication protocol. i.e The data will transfer
from source to destination and destination to source simultaneously.
2. Connection Oriented Service:-
TCP follows connection oriented services. First we can establish a
connection between source to destination. After establish a connection,
then The data will transfer from source to destination. Once the data
transfer is done connection is terminated. Here the connection involves 3
phases.
a) establish a connection [ use 3-way hand shack]
b) transferring data
c) terminating connection
3.Reliable Service: -
TCP provides the reliable services i.e It provides guarantee to the
sender will arrives at the receiver. It uses Acknowledgements, sequence
numbers and retransmission.
4.Process to Process Communications: -
A process in sender side will communicate with process in receiver side. The
communication is done by port numbers. Here we have 1024 pre-defined
port numbers.
Example: 80 -> HTTP
25 -> SMTP
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.
5.Stream Delivery Service: -
Sender process can send data with stream of bytes to the receiver
process. Stream is nothing but collection of bytes. Those bytes are stored in
a buffer.
6.Segments: -
On top of transport layer is session layer and bottom of transport layer
is network layer. In the application layer we have a message i.e large
message. The large message can split into no. of parts those are called
segments. The transport layer adds a header to each segment and transmit
those to the corresponding down layer i.e network layer.
7.Flow Control: -
Let us assume that sender sends data segments at faster rate and
receiver receive the data segments at slower rate. Then some data
segments are lost. But TCP can provide various flow control mechanisms.
8.Error Control: -
The transport layer checks for errors in the messages coming from the
application layer by using error detection codes, and computing checksums,
it checks whether the received data is not corrupted and uses the ACK and
NACK services to inform the sender if the data has arrived or not and
checks for the integrity of data.
9.Guarantee Delivery: -
If sender sends a data segment that data segment is arrived at
receiver side safely. TCP can ensure that guarantee for safe arrival for those
data segments from sender to receiver.
*****************************
TCP [transmission Control Protocol]
TCP stands for Transmission Control Protocol. Itenables application
programs and computing devices to exchange messages over a network. It
is designed to send packets across the internet and ensure the successful
delivery of data and messages over networks.

 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, demultiplexingand also implements
congestion-control mechanism.
 It included the following contents. They are
1. Services 5. Flow control
2. Features 6. Error control
3. Header format [segment] 7. Congestion Control
4. Connection
TCP Header format [segment] : -

The header size of a TCP segment can range from 20-60 bytes. 40 bytes for
options field size. If there are no options field, a header size is 20 bytes
otherwise it can be of 60 bytes.
TCP Header fields:
a)Source Port Address:- [2 Bytes]
A 16-bit field that holds the port address of the application that is sending
the data segment.
b) Destination Port Address:- [2 Bytes]
A 16-bit field that holds the port address of the application in the host that
is receiving the data segment.
c) Sequence Number:- [ 4 Bytes]
A 32-bit field that holds the sequence number, i.e, The process of source
host machine sends data segments to destination host machine. Let us
assume Segment [data] range from 9001-10000. i.e Here the size of the
segment is 1000 bytes. Sequence number always specifies the first byte of
the segment. i.e sequence number of the above example is 9001.
d) Acknowledgement Number:- [ 4 Bytes]
A 32-bit field that holds the acknowledgement number, let us assume the
sender sends a segment “x” then the receiver receives the segment from
the sender and provides an acknowledgement [x+1] to the sender .
e) Header Length (HLEN):- [4 bits]
The size of the header length is 4 bits. i.e 1 1 1 1 [ 15 bits] but
maximum size of header size is 60 bytes.
i.e each bit represents 4 bytes .i.e 15 * 4=60 bytes.
Minimum size of the header is 20 i.e 20/4= 5 i.e 0 1 0 1 . 5*4= 20 Bytes
Therefore, the size of the header length ranges from 5 [minimum] to 15
[maximum]and each bit represents in 4 bytes.
f) Control flags:-–
These are 6 1-bit control bits that control connection establishment,
connection termination, connection abortion, flow control, mode of transfer
etc. Their function is:
SYN: [Synchronization]
It is used to establish a connection between source host to destination
host. Then source host set SYN flag to 1 and destination also want to
connect with source then SYN segment to the source.
PSH: [Request for push]
It is used to send some data to the receiver. PSH=1
URG: [Urgent pointer is valid]
RST: Reset the connection
FIN: Terminate the connection
ACK: Acknowledgement number is valid (used in case of cumulative
acknowledgement)
g) Window size: - [2 bytes]
This field is also called receiver window size. After setting the window size
by the receiver, theninform to the window size information to the sender.
h) Checksum:- [2 bytes]
This field mainly used for error control and error detection.
i)Urgent pointer:-
This field is used hold the urgent byte data address.
TCP Connections
[ 3-way hand shaking]
It is a connection-oriented protocol and every connection-oriented
protocol needs to establish a connection in order to reserve resources at
both the communicating ends.
It mainly involues 3 phases
 Connection Establishment
 Data Transfer
 Tcp Connection Termination

 Connection Establishment –
TCP uses full duplex communication. i.e data will be transferred in both
directions. Here connection establishment TCP uses 3-way handshaking
mechanism. We require 3 steps.
Step1: -Client is sending a SYN
segment to the server in order to
establish a connection with server.
i.e seq=100
Step 2: - Server acknowledges the
client segment and server send
SYN segment to the client. i.e
server sending SYN+ACK [101 ]to
the client machine.
Step 3: - client provide
acknowledge to the server i.e client
is ready to have a connection with
server [ seq=101 & ack=201].
 Data Transfer:-
Here client is sending 2 segments [8001 &9001] and each segment size is
1000 bytes. Server sending one segment and size of the segment is 2000
bytes.
 Client is sending a segment to the server, that segment data contains
byte from 8001 [ first byte of the segment] – 9000 to the server and client is
excepting 15001 seq number from the server.
 Here both client and server uses the concept like Piggybacking. i.
e“along with the data the corresponding machine with send
acknowledgement”.

 Tcp Connection Termination:-


TCP connection termination is made with 2 ways. They are
 3-way handshaking
 4-way handshaking
Client has no data send to the server at that time client sends a FIN
segment to the server. When FIN segment is send by the client then
connection will be terminated this is called Half Close.
Client has received FIN with ACK from the server and client sends ACK to
the server. i.e server to client connection will be terminated.
4-way handshaking having 4 segments [4 steps]. server has sending
some data to the client at that time operation will be performed. Client has
received FIN from the server and client sends ACK to the server. i.e server
to client connection will be terminated.

Flow Control
Flow control is a technique used to control the flow of data between
different nodes in a network. It is used to prevent buffer overflow, which can
lead to dropped packets and poor network performance.

Congestion Control in TCP


The size of the sender window is determined by the following two factors
1. Receiver window size
2. Congestion window size

1. Receiver Window Size


• Sender should not send data greater than receiver window size.
• Otherwise, it leads to dropping the TCP segments which causes TCP
Retransmission.
• So, sender should always send data less than or equal to receiver window
size.
• Receiver dictates its window size to the sender through TCP Header.
2. Congestion Window
• Sender should not send data greater than congestion window size.
• Otherwise, it leads to dropping the TCP segments which causes TCP
Retransmission. So, sender should always send data less than or equal to
congestion window size.
• Different variants of TCP use different approaches to calculate the size of
congestion window.Congestion window is known only to the sender and is
not sent over the links.
S.NO Flow Control Congestion Control
Traffic from sender to receiver Traffic entering the network
1. is controlled, to avoid from a sender is controlled by
overlapping the slow receiver. reducing rate of packets.

It is used in network and


2. It is used in data link layer. transport layer.
Receiver’s data is Network is prevented from
3. preventedfrom being congestion.
overwhelmed.
It is designed to prevent
network congestions are
Types of Flow control are
4.
1. Network Queue
1. Stop and Wait
Management
2. Sliding Window
2. Explicit Congestion
Notification
3. TCP Congestion control

Error Control
TCP provides reliability using error control. Error control includes
mechanisms for detecting corrupted segments, lost segments, out-of-order
segments, and duplicated segments.
Error control also includes a mechanism for correcting errors after they are
detected. Error detection and correction in TCP is achieved through the use
of three simple tools: checksum, acknowledgment, and time-out.
1. Checksum
Each segment includes a checksum field which is used to check for a
corrupted segment. If the
segment is corrupted, it is discarded by the destination TCP and is
considered as lost. TCP uses a 16-bit checksum that is mandatory in every
segment.
2. Acknowledgment
TCP uses acknowledgments to confirm the receipt of data segments.
Control segments that carry no data but consume a sequence number are
also acknowledged. ACK segments are never acknowledged.
3. Retransmission
The heart of the error control mechanism is the retransmission of segments.
When a segment is corrupted, lost, or delayed, it is retransmitted. In
modern implementations, a segment is retransmitted on two occasions:
when a retransmission timer expires or when the sender receives three
duplicate ACKs.

****************************************
User Data Gram [UDP] Protocol
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
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.
UDP features: -
 Connection less
 Unreliable
 No guarantee delivery
 Less overhead [ no seqno, ack, retransmission]
 No flow control

UDP HEADER FRAME 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)
 It uses on process-to-process communication. i.e source host process
can send packets to destination host process with the help of some port
numbers.
 We can send data range from 0 to 65,535 i.e 216
UDP header contains four main parameters:
 Source Port - This 16 bits’ information is used to identify the source
port of the packet.
 Destination Port - This 16 bits’ information, is used identify application
level service on destination machine.
 Length - Length field specifies the entire length of UDP packet
(including header). It is 16-bits field and minimum value is 8-byte, i.e.
the size of UDP header itself.
 Checksum - This field stores the checksum value generated by the
sender before sending. It is mainly used for error detection.

UDP applications
Here are few applications where UDP is used to transmit data:
 Domain Name Services
 Simple Network Management Protocol
 Trivial File Transfer Protocol
 Routing Information Protocol
 Kerberos
*******************************

You might also like