Unit V Part-1 Transport Layer Services
Unit V Part-1 Transport Layer Services
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
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”.
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.
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 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
*******************************