0% found this document useful (0 votes)
2 views30 pages

Tcp

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 30

TCP - segment

structure,RTT
estimation
Understanding the backbone of reliable
data transmission in networks
prepared by:
RATHIGHA.S
2201112035
INFORMATION TECHNOLOGY
Agenda
1. introduction
2. TCP features

3.TCP segment structure overview


.TCP header file
. key components
4.TCP segment structure
5. RTT estimation
. Measuring RTT
. factors affecting RTT
. advantages of RTT
. disadvantages of RTT
. applications of RTT
6.conclusion
7.references
INTRODUCTION
The Transmission Control Protocol is the most common transport layer
protocol. It works together with IP and provides a reliable transport
service between processes using the network layer service provided
by the IP protocol.

A Transmission Control Protocol (TCP) segment is made up of a TCP


header and data. The TCP header contains information about the
sender and recipient ports, segment ordering, and a checksum. The
data in a TCP segment can be part of a file transfer or a response to
an HTTP request.
TCP features

Go Back to Agenda Page


Here are some features of Transmission Control Protocol (TCP)

1.Connection management
Includes connection initialization and termination, which is done using a 3-way
handshake.
2.Flow control
Ensures that messages are delivered in the correct order. The receiving TCP process
indicates the highest sequence number it can receive.
3.Congestion control
Prevents over-congestion of traffic on routers and links between two hosts. When
segments get lost, TCP automatically reduces the transmission rate.
4.Reliability
Guarantees delivery of messages.
Need for Transport Control Protocol

In the layered architecture of a network model, the whole task is divided into
smaller tasks. Each task is assigned to a particular layer that processes the task. In
the TCP/IP model, five layers are application layer, transport layer, network layer,
data link layer, and physical layer. The transport layer has a critical role in providing
end-to-end communication to the directly application processes. It creates 65,000
ports so that the multiple applications can be accessed at the same time. It takes
the data from the upper layer, and it divides the data into smaller packets and then
transmits them to the network layer.
Working of TCP
In TCP, the
connection is established by using three-way handshaking. The client sends
the segment with its sequence number. The server, in return, sends its
segment with its own sequence number as well as the acknowledgement
sequence, which is one more than the client sequence number. When the
client receives the acknowledgment of its segment, then it sends the
acknowledgment to the server. In this way, the connection is established
between the client and the server.
TCP segment
structure overview
The TCP segment consists of header fields and a data field.
The data field contains a chunk of application data. The
MSS (Maximum Segment Size) limits the maximum size of
a segment’s data field.When TCP sends a large file, such
as an image as part of a web page, it typically breaks the
file into chunks of size MSS (except for the last chunk,
which will often be less than the MSS).

Interactive applications, however, often transmit data


chunks that are smaller than the MSS; for example, with
remote login applications like Telnet, the data field in the
TCP segment is often only one byte. Because the TCP
header is typically 20 bytes (12 bytes more than the UDP
header), segments sent by Telnet may be only 21 bytes in
length.
TCP segment structure
A TCP segment is a unit of data that is transmitted over a network using the
Transmission Control Protocol (TCP). The structure of a TCP segment includes
several fields that are essential for the proper functioning of the protocol.
Here are the key components of a TCP segment:
1.Source Port Number
2.Destination Port Number
3.Sequence Number
4.Acknowledgment Number
5.Data Offset
6.Reserved
7.Flags
8.Checksum
9.Urgent Pointer
10.Options
11.Padding
TCP SEGMENT
STRUCTURE
1.Source Port Number: A 16-bit field that identifies the source port number.

2.Destination Port Number: A 16-bit field that identifies the destination


port number.

3.Sequence Number: A 32-bit field that indicates the sequence number of


the first data byte in the segment. If the segment contains a SYN flag, the
sequence number is the initial sequence number (ISN) and the first data byte
will be ISN+1.
TCP SEGMENT STRUCTURE

4.Acknowledgment Number: A 32-bit field that


contains the next sequence number that the sender of
the ACK expects to receive. This field is valid only if the
ACK flag is set.

5.Data Offset: A 4-bit field that specifies the size of


the TCP header in 32-bit words. This indicates where
the data begins.

6.Reserved: A 6-bit field that is reserved for future use


and should be set to zero.
TCP SEGMENT STRUCTURE

7.Flags: A 6-bit field that includes several control flags such


as:
URG (Urgent Pointer field significant)
ACK (Acknowledgment field significant)
PSH (Push Function)
RST (Reset the connection)
SYN (Synchronize sequence numbers)
FIN (No more data from sender)

8.Window: A 16-bit field that specifies the size of the


receive window, which is the number of bytes that the
receiver is willing to accept.
TCP SEGMENT STRUCTURE

9.Checksum: A 16-bit field used for error-checking of


the header and data.
10.Urgent Pointer: A 16-bit field that points to the
end of urgent data.
11.Options: A variable-length field that can include
options such as Maximum Segment Size (MSS),
Window Scale, and Timestamps.
12.Padding: Used to ensure that the header length is
a multiple of 32 bits.
RTT
ESTIMATION
RTT
RTT (Round Trip Time) also called round-trip delay is a crucial tool in
determining the health of a network. It is the time between a request for data
and the display of that data. It is the duration measured in milliseconds.
RTT can be analyzed and determined by pinging a certain address. It refers to
the time taken by a network request to reach a destination and to revert back
to the original source. In this scenario, the source is the computer and the
destination is a system that captures the arriving signal and reverts it back.

Measures of RTT
There are three ways to calculate RTT:
1.Estimated RTT
2.Deviation in RTT
3.Time-out Interval
Steps To Calculate the Expected Round Trip Time

Step 1: Select a Destination. Identify the target device or destination for which you want to calculate the
expected RTT. This can be an IP address or a domain name.
Step 2: Choose a Measurement Tool. Select a suitable measurement tool or utility that can help you measure
the Round Trip Time accurately. There are several tools available, such as ping, traceroute, or network
monitoring software.
Step 3: Open the Command Prompt (Windows) or Terminal (Mac/Linux). To access the ping command, you
need to open the command prompt on Windows or the terminal on Mac/Linux. You can do this by searching for
“Command Prompt” or “Terminal” in the respective operating system’s search bar.
Step 4: Enter the Ping Command. In the command prompt or terminal, type the following command: ping
<target> (replace <target> with the IP address or domain name of your target device).
Step 5: Initiate the Ping Test. Now, Press the Enter key to execute the ping command. The utility will start
sending ICMP (Internet Control Message Protocol) echo request packets to the target device.
Step 6: Observe the Results. As the ping utility sends packets, it records the Round Trip Time for each packet
received. The utility will display the results for each packet sent, along with the statistics at the end of the test.
Look for the “Average” or “Avg” value in the statistics, as it represents the average Round Trip Time.
Step 7: Calculate the Expected RTT. The average Round Trip Time displayed in the ping statistics is an
estimation of the expected RTT.
Step 8: Repeat the Process (Optional)
Estimated RTT
In computer communication networking, the RTTs of diff erent packets can be diff erent.
For example, the first packet takes the round trip time of 1.1ms, the second packet
takes 1.3ms, and the third packet takes 0.98ms so, each sample RTT varies. That is
why estimated RTT is used, as it is the average of recent measurements, not just the
current sample RTT.

Formula:
Estimated RTT = (1- α) * Estimated RTT + α * Sample RTT

Where typically, the value of α = 0.125.

For example, the sample RTT is 100ms, we have to compute the estimated RTT using α =
0.125, and we assume the value of the estimated RTT just before the sample RTT was
110ms. So, by using the formula, we get:

Estimated RTT = (1-0.125) * 110ms + (0.125) * 100ms

Estimated RTT = (0.875) * 110ms + 12.5ms


Estimated RTT = 96.25ms + 12.5ms = 108.75ms
Hence, the required estimated RTT is 108.75ms.
Steps to calculate deviation in RTT:
STEP - 1: Determine differences: Subtract the mean RTT from each RTT
measurement to find the difference.
STEP - 2: Square differences: Square each difference to get positive
values.
STEP - 3: Sum squared differences: Add up all the squared differences.
STEP - 4: Calculate variance: Divide the sum of squared differences by
the number of measurements.
Deviation in RTT
Deviation
Deviation in RTT, also known asinDev-RTT
RTT is a measure that indicates
Deviation
how evenlyinthe
RTT,
RTTalso known as Dev-RTT
is distributed during theismeasurement.
a measure that It depends
indicates
upon how evenly
the previous the RTT
estimated RTTisand
distributed
helps to during the
find the retransmission
measurement. It depends upon the previous estimated RTT and
time-out.
helps to find the retransmission time-out.
Formula:
Formula:
DevRTT = (1- β) * DevRTT + β * |Sample RTT - Estimated
DevRTT = (1- β) * DevRTT RTT|
+ β * |Sample RTT - Estimated RTT|
Where
Where typically, the value
typically, of β = of
the value 0.125.
β = 0.125.
For example, the sample RTT is 100ms, we have to compute
For example, the sample RTT is 100ms, we have to compute
the DevRTT, and we assume the value of the estimated RTT is
the DevRTT, and we assume the value of the
108.75ms and the previous DevRTT was 20ms. So, by using the estimated RTT is
108.75ms and the formula,
previous weDevRTT
get: was 20ms. So, by using
the formula,
Dev RTT = (1-0.125) * 20ms + (0.125) we get: - 108.75ms|
* |100ms
Dev RTT Dev=RTT = (0.875)
(1-0.125) * *20ms
20ms + + (0.125)
(0.125)* 8.75ms
* |100ms - 108.75ms|
DevRTT
Dev RTT =
= 17.5ms
(0.875)+*1.09ms
20ms =+18.59ms
(0.125) * 8.75ms
Hence, the required DevRTT is 18.59ms
Dev RTT = 17.5ms + 1.09ms = 18.59ms
Hence, the required DevRTT is 18.59ms
Time-out
Time-out is longer than RTT, but as RTT varies, we need to add some margin i.e.,
safety margin, to it. The selection of a time-out value is essential because the longer
the value of estimated RTT, the slower its performance. We will be facing long delays in
this case. Similarly, in the case of a minimal value, the connection can be lost before
the RTT completes or before the arrival of the response or acknowledgment. So for the
safety, we use:

Formula:
Time-out Interval = 4 * DevRTT + Estimated RTT

Where the DevRTT value is used for a safety margin.


So, using the above-computed values of DevRTT = 18.59ms and Estimated RTT =
108.75ms, we compute the time-out interval as:
Time-out Interval = 4 * 18.59ms + 108.75ms
Time-out Interval = 74.36ms + 108.75ms = 183.11ms
Hence, the required time-out interval is 183.11ms.
What Are Common Factors that Affect RTT?
There are certain factors that can bring huge changes in the value of RTT.
These are enlisted below:
Distance: It is the length in which a signal travels for a request to reach the
server and for a response to reach the browser,
Transmission medium: The medium which is used to route a signal, which
helps in faster transfer of request is transmitted.
Network hops: It is the time that servers take to process a signal, on
increasing the number of hops, RTT will also increase.
Traffic levels: Round Trip Time generally increases when a network is having
huge traffic which results in that, for low traffic RTT will also be less.
Server response time: It is the time taken by a server to respond to a
request which basically depends on the capacity of handling requests and also
sometimes on the nature of the request.
ADVANTAGES OF RTT

Calculation of RTT is advantageous because:

1.It allows users and operators to identify how long a


signal will take to complete the transmission.
2.It also determines how fast a network can work and
the reliability of the network.
some disadvantages of RTT include:
Uncontrollable factors
Many factors can affect RTT, such as network congestion, physical distance, and server capacity.
Degraded performance
An RTT of 200 milliseconds or more can cause long wait or page load times. An RTT of more than 375 milliseconds
can often result in a terminated connection.
Incorrect estimates
If the round-trip time estimate is too low, segments may be retransmitted before the original segment has
propagated through the network. If the round-trip time estimate is too high, time-outs will be longer than necessary.
RTT is the time it takes for a packet of data to travel from the source to the destination and back. It's closely related
to latency, but RTT includes the entire journey of the data packet.
APPLICATIONS OF RTT
Round-trip time (RTT) is a critical metric in network technology that has many
applications, including:

Measuring network health: RTT is a key indicator of the health of a network


connection, and is used by network administrators to diagnose issues.
Improving network performance: Reducing RTT is a primary goal of a CDN, and can
help improve latency.
Measuring page load times: RTT is a key factor in measuring page load times, along
with Time to First Byte (TTFB).
Measuring connection speed: RTT is used to measure the speed of
connections for applications like gaming, video conferencing, and
other online interactive applications.
Measuring DNS query speed: RTT is used to measure the speed of
DNS queries.
Measuring image load time: RTT is used to measure how long it
takes to load images and other objects from a website.
Directing data packet exchange: RTT is used in networking
protocols like Transmission Control Protocol (TCP) to direct the
exchange of data packets.

RTT is measured in milliseconds (ms) and can be estimated using the


ping utility, which is available on most computers.
REFERENCES
1.James F. Kurose and Keith W. Ross, “Computer
Networking: A Top-Down Approach Featuring the
Internet”, Pearson Education, 3rd edition, 2006.

2.Andrew S. Tanenbaum, “Computer Networks”,


Prentice-Hall of India, 4th edition, 2003.
Thank you!

You might also like