0% found this document useful (0 votes)
1K views15 pages

Cs3591 - CN Unit 2 Transport Layer

Uploaded by

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

Cs3591 - CN Unit 2 Transport Layer

Uploaded by

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

CS3591 – Computer Networks Unit 2

UNIT – II : TRANSPORT LAYER

Introduction – Transport Layer Protocols – Services – Port Numbers –


User Datagram Protocol – Transmission Control Protocol – SCTP.

1. 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).

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.
 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

1
CS3591 – Computer Networks Unit 2

3. 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.

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. 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

UDP PORTS
Processes (server/client) are identified by an abstract locator known as
port. Server accepts message at well known port.
2
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.

3
CS3591 – Computer Networks Unit 2

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).

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
CS3591 – Computer Networks Unit 2

UDP SERVICES
Process-to-Process Communication
UDP provides process-to-process communication using socket addresses, a
combination of IP addresses and port numbers.

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.

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.

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.

5
CS3591 – Computer Networks Unit 2

The lack of error control means that the process using UDP should provide for this
service, if needed.

5. 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.

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.

6
CS3591 – Computer Networks Unit 2

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.

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:
1. The two TCP’s establish a logical connection between them.
2. Data are exchanged in both directions.
3. The connection is terminated.

Reliable Service
TCP is a reliable transport protocol.
It uses an acknowledgment mechanism to check the safe and sound arrival of data.

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.

7
CS3591 – Computer Networks Unit 2

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.

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.

SrcPort and DstPort―port number of source and destination process.


SequenceNum―contains sequence number, i.e. first byte of data segment.
Acknowledgment― byte number of segment, the receiver expects next.
HdrLen―Length of TCP header as 4-byte words.
Flags― contains six control bits known as flags.
o URG — segment contains urgent data.
o ACK — value of acknowledgment field is valid.
o PUSH — sender has invoked the push operation.
o RESET — receiver wants to abort the connection.
o SYN — synchronize sequence numbers during connection establishment.
o FIN — terminates the TCP connection.

8
CS3591 – Computer Networks Unit 2

Advertised Window―defines receiver’s window size and acts as flow control.


Checksum―It is computed over TCP header, Data, and pseudo header containing IP fields
(Length, SourceAddr & DestinationAddr).
UrgPtr ― used when the segment contains urgent data. It defines a value that must be
added to the sequence number.
Options - There can be up to 40 bytes of optional information in the TCP header.

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.

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.

1. Client sends a SYN segment to the server containing its initial sequence number (Flags
= SYN, SequenceNum = x)
2. Server responds with a segment that acknowledges client’s segment and specifies its
initial sequence number (Flags = SYN + ACK, ACK = x + 1 SequenceNum = y).
3. Finally, client responds with a segment that acknowledges server’s sequence number
(Flags = ACK, ACK = y + 1).

9
CS3591 – Computer Networks Unit 2

The reason that each side acknowledges a sequence number that is one larger
than the one sent is that the Acknowledgment field actually identifies the “next
sequence number expected,”
A timer is scheduled for each of the first two segments, and if the expected
response is not received, the segment is retransmitted.

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.

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.

Client sends a FIN segment.


The FIN segment can include last
chunk of data.
Server responds with FIN + ACK
segment to inform its closing.
Finally, client sends an
ACK segment

Half-Close—Client stops sending but receives data.


Client half-closes the
connection by sending a FIN
segment.
Server sends an ACK segment.
Data transfer from client to the
server stops.
After sending all data, server sends
FIN segment to client, which is
acknowledged by the client.

10
CS3591 – Computer Networks Unit 2

TCP CONGESTION CONTROL


Congestion occurs if load (number of packets sent) is greater than capacity of the
network (number of packets a network can handle).
When load is less than network capacity, throughput increases proportionally.
When load exceeds capacity, queues become full and the routers discard some
packets and throughput declines sharply.
When too many packets are contending for the same link
o The queue overflows
o Packets get dropped
o Network is congested
Network should provide a congestion control mechanism to deal with such a
situation.
TCP maintains a variable called CongestionWindow for each
connection. TCP Congestion Control mechanisms are:

1. Additive Increase / Multiplicative Decrease (AIMD)


2. Slow Start
3. Fast Retransmit and Fast Recovery

Additive Increase / Multiplicative Decrease (AIMD)


TCP source initializes CongestionWindow based on congestion level in the network.
Source increases CongestionWindow when level of congestion goes down and
decreases the same when level of congestion goes up.
TCP interprets timeouts as a sign of congestion and reduces the rate of transmission.
On timeout, source reduces its CongestionWindow by half, i.e., multiplicative
decrease. For example, if CongestionWindow = 16 packets, after timeout it is 8.
Value of CongestionWindow is never less than maximum segment size (MSS).
When ACK arrives CongestionWindow is incremented marginally, i.e., additive
increase.
Increment = MSS × (MSS/CongestionWindow)
CongestionWindow += Increment

11
For example, when ACK arrives for 1 packet, 2 packets are sent. When ACK for
both packets arrive, 3 packets are sent and so on.
CongestionWindow increases and decreases throughout lifetime of the connection.

12
CS3591 – Computer Networks Unit 2

6. 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.

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.

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.

13
CS3591 – Computer Networks Unit 2

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.

Reliable Service
SCTP is a reliable transport protocol.
It uses an acknowledgment mechanism to check the safe and sound arrival of data.

SCTP PACKET FORMAT

An SCTP packet has a mandatory general header and a set of blocks called chunks.

General Header
The general header (packet header) defines the end points of each association to
which the packet belongs
It guarantees that the packet belongs to a particular association
It also preserves the integrity of the contents of the packet including the header
itself. There are four fields in the general header.
Source port
This field identifies the sending port.

Destination port
This field identifies the receiving port that hosts use to route the packet to the
appropriate endpoint/application.

14
CS3591 – Computer Networks Unit 2

Verification tag
A 32-bit random value created during initialization to distinguish stale packets
from a previous connection.
Checksum
The next field is a checksum. The size of the checksum is 32 bits. SCTP uses
CRC-32 Checksum.

15

You might also like