0% found this document useful (0 votes)
23 views

Chapter 4 Transport Layer

The document summarizes key aspects of the transport layer: - The transport layer provides logical communication between application processes on different hosts. It resides between the application and network layers. - Transport layer protocols like TCP and UDP provide multiplexing/demultiplexing of data streams using port numbers and ensure reliable/unreliable data transmission. - TCP establishes connections using three-way handshake and provides reliable in-order delivery through sequence numbers, acknowledgments, and error checking. UDP is connectionless and unreliable.

Uploaded by

Tanu Srivastava
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Chapter 4 Transport Layer

The document summarizes key aspects of the transport layer: - The transport layer provides logical communication between application processes on different hosts. It resides between the application and network layers. - Transport layer protocols like TCP and UDP provide multiplexing/demultiplexing of data streams using port numbers and ensure reliable/unreliable data transmission. - TCP establishes connections using three-way handshake and provides reliable in-order delivery through sequence numbers, acknowledgments, and error checking. UDP is connectionless and unreliable.

Uploaded by

Tanu Srivastava
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

ECE303 Communication Networks

Chapter 4
Transport Layer
DR. SHUVABRATA BANDOAPDHAYA
Transport Layer
Transport layer residing between the application and network layers

A transport layer protocol provides for logical communication


between application processes running on different hosts.

Transport layer protocols are implemented in the end systems but not
in network routers.

BANASTHALI 2
BANASTHALI 3
Concept of Logical communication
Although the communicating application processes are not physically connected
to each other, from the applications' viewpoint, it is as if they were physically
connected.

The communicating application processes may be on different sides of the planet,


connected via numerous routers and a wide range of link types.

Application processes use the logical communication provided by the transport


layer to send messages to each other, free for the worry of the details of the
physical infrastructure used to carry these messages.

BANASTHALI 4
What Transport layer does:
At sending side:
The application messages are broken into smaller chunks.
To each chunk of data, a transport-layer header is added to create 4-PDUs (Packet data unit).
The transport layer then passes the 4-PDUs to the network layer, where each 4-PDU is
encapsulated into a 3-PDU.
At the receiving side:
The transport layer receives the 4-PDUs from the network layer,
Removes the transport header from the 4-PDUs,
Reassembles the messages and passes them to a receiving application process.

BANASTHALI 5
Types of transport layer protocols
1. UDP (User Datagram Protocol): provides an unreliable, connectionless service to
the invoking application.

2. TCP (Transmission Control Protocol): It provides a connection-oriented reliable


service to the invoking application using techniques like flow control, sequence
numbers, acknowledgments and timers.

BANASTHALI 6
Multiplexing and Demultiplexing
At the transmitting end, the multiplexing process includes:
1. gathering data at the source host from different application processes,
2. enveloping the data with header information to create segments, and
3. passing the segments to the network layer.
The header information will later be used in demultiplexing at receiver end.
At the receiving end, the demultiplexing process includes:
1. examining this field to determine the correct receiving process, and
2. then directing the segment to that application process.

BANASTHALI 7
UDP and TCP perform the demultiplexing and multiplexing jobs by including two special fields in the
segment headers:
1. the source port number field and
2. the destination port number field
The port number is a 16-bit number, ranging from 0 to 65535.
The port numbers ranging from 0 - 1023 are called well-known port numbers as they are reserved for
use by well-known application protocols such as HTTP and FTP.
When we develop a new application, we must assign the application a port number.

BANASTHALI 8
Unreliable Network

The Internet's network-layer protocol or "Internet Protocol" (IP)


provides logical communication between hosts.
The IP service model is a best-effort delivery service but it makes no
guarantees.
1. It does not guarantee segment delivery,
2. It does not guarantee orderly delivery of segments, and
3. It does it guarantee the integrity of the data in the segments.
Hence, IP is said to be an unreliable service.

BANASTHALI 9
UDP
It is a Connectionless unreliable transport services best suited for the applications which:
1. can tolerate a small fraction of packet loss, so that reliable data transfer is not absolutely
critical for the success of the application
2. But overhead and corresponding delay degrades the system performance
Examples of such applications are:
i. Internet phone
ii. Real-time video conferencing
iii. Streaming of stored audio and video
iv. Name translation using DMS
v. Routing update using RIP protocol
vi. Network management using SNMP protocol

BANASTHALI 10
Why UDP is better than TCP in time-sensitive
applications?
i. No connection establishment

ii.No connection states

iii.Small segment header overhead

iv.Unregulated send rate


 

BANASTHALI 11
Transmission Control Protocol (TCP)
It is a transport layer protocol resides between application layer and
network/ internet layer
• It is a transport layer protocol that facilitates
the transmission of packets from source to
destination.
• The main functionality of the TCP is to take
the data from the application layer.
• Then it divides the data into a several
packets, provides numbering to these
packets, and finally transmits these packets
to the destination.
• The TCP, on the other side, will reassemble
the packets and transmits them to the
application layer.
Features of TCP protocol
 Connection-oriented data service:
 A TCP connection between source and destination is being established before data
transmission.

 The TCP connection is also terminated after completion of data exchange.

 Reliable data transmission:


 Though packet transmission happens via unreliable IP protocol, necessary measures has
been taken to make the data delivery reliable.

 It provides error-free, without duplication and in order of sequence data service.

 To ensure reliable data delivery, congestion control, error detection and flow control
mechanism has been introduced.
Stream-oriented data service
 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 data across the Internet.
Sending and Receiving Buffers
•Because the sending and the receiving
processes may not write or read data at the
same speed, TCP needs buffers for storage.
• There are two buffers for each direction:
A. Sending buffer
B. Receiving buffer
•The movement of the data in one direction.
At the sending site, the buffer has three types of chambers.
1. The white section contains empty chambers that can be filled by the sending process

2. The gray area holds bytes that have been sent but not yet acknowledged. TCP keeps
these bytes in the buffer until it receives an acknowledgment.

3. The colored area contains bytes to be sent by the sending TCP.


TCP Segment
 Transmission Control Protocol accepts data from a data stream, divides it into chunks, and adds a
TCP header creating a TCP segment.

 The TCP segment is then encapsulated into an Internet Protocol (IP) datagram, and exchanged
with peers.

 A TCP segment consists of a segment header and a data section.

 Segment header contains 10 mandatory fields (2 bytes each), and an optional extension field

 The header length ranges between 20- to 60-byte.

 The header is 20 bytes if there are no options and up to 60 bytes if it contains options.

 The data section follows the header and is the payload data carried for the application.
Source port (16 bits): Identifies the sending port.

Destination port (16 bits): Identifies the receiving port.

Sequence number (32 bits)


Has a dual role:
• If the SYN flag is set (1), then this is the initial sequence number. The sequence number of the actual
first data byte and the acknowledged number in the corresponding ACK are then this sequence number
plus 1.
• If the SYN flag is clear (0), then this is the accumulated sequence number of the first data byte of this
segment for the current session.

Acknowledgment number (32 bits): If the ACK flag is set then the value of this field is the next sequence
number that the sender of the ACK is expecting.

Data offset (4 bits): Specifies the number of 32-bit words of data in the TCP header.

Reserved (6 bits): For future use and should be set to zero.


Control Flags (6 bits):
Window size (16 bits): Indicates the number of octets of data the sender of this segment is
willing to accept from the receiver at one time depends on the current size of the buffer
allocated to accept data for this connection.

Checksum (16 bits): The 16-bit checksum field is used for error-checking of the TCP header, the
payload and an IP pseudo-header (source IP address + destination IP address +protocol number
+length of the TCP headers and payload in bytes).

Urgent pointer (16 bits): If the URG flag is set, then this 16-bit field is an offset from the
sequence number indicating the last urgent data byte.

Options (Variable 0–320 bits, in units of 32 bits):


TCP Protocol operation
• Operation of TCP protocol includes following steps:

1) Establish connection

2) Send packets of data

3) Close the connection


Connection establishment
When two computers want to send data to each other over TCP, they first need to establish
a connection using a three-way handshake.
1. The first computer sends a packet with the SYN bit set to 111 (SYN = "synchronize?").
2. The second computer sends back a packet with the ACK bit set to 111 (ACK =
"acknowledge!") plus the SYN bit set to 111.
3. The first computer replies back with an ACK.
• The three packets involved in the three-way handshake do not typically include any data.

• Once the computers are done with the handshake, they're ready to receive packets
containing actual data.
Reliable Data transfer:
When a packet of data is sent over TCP, the recipient must always acknowledge what
they received.

1. The first computer sends a packet with data and a sequence number.
2. The second computer acknowledges it by setting the ACK bit and increasing the
acknowledgement number
Connection Termination
Either computer can close the connection when they no longer want to send or
receive data.
1) A computer initiates closing the connection by sending a packet with the FIN bit set
to 1 (FIN = finish).
2) The other computer replies with an ACK and another FIN.
3) After one more ACK from the initiating computer, the connection is closed.
Error detection
Error control in TCP is mainly done through the use of three simple techniques:
1) Checksum – Every segment contains a checksum field which is used to find corrupted
segments. If the segment is corrupted, then that segment is discarded by the
destination TCP and is considered lost.

2) Acknowledgement – TCP has another mechanism called acknowledgement to affirm


that the data segments have been delivered. Control segments that contain no data
but have sequence numbers will be acknowledged as well.

3) Retransmission – When a segment is missing, delayed to deliver to a receiver,


corrupted when it is checked by the receiver then that segment is retransmitted
again. Segments are retransmitted only during two events: when the sender receives
three duplicate acknowledgments (ACK) or when a retransmission timer expires.
Detecting lost packets
 TCP connections can detect lost packets using a timeout.
 After sending off a packet, the sender starts a timer and puts the packet in retransmission queue.
 If the timer runs out and the sender has not yet received an ACK from the recipient, it sends the
packet again.
 The retransmission may lead to the recipient receiving duplicate packets, if a packet was not
actually lost but just very slow to arrive or be acknowledged.
 If so, the recipient can simply discard duplicate packets.
Handling out of order packets
• TCP connections can detect out of order packets by
using the sequence and acknowledgement numbers.
• When the recipient sees a higher sequence number
than what they have acknowledged so far, they know
that they are missing at least one packet in between.
• Ex: Recipient sees a sequence number of #73 but
expected a sequence number of #37.
• The recipient lets the sender know there's something
amiss by sending a packet with an acknowledgement
number set to the expected sequence number.
• It asks for retransmit. The recipient uses the
sequence numbers to reassemble the packet data in
the correct order.

You might also like