Acn Project
Acn Project
1. INTRODUCTION 1.
7. CONCLUSION 8.
REFERENCES
TCP SEGMENT
SEGMENT SEGMENTS
SESEGMENT
INTRODUCTION
A TCP segment is a unit of data exchanged between devices in a TCP/IP network. It is a part of the TCP
(Transmission Control Protocol) protocol suite, which operates at the transport layer of the OSI model. In TCP
communication, large messages are divided into smaller segments for efficient transmission over the network.
Each segment contains header information, including source and destination port numbers, sequence number,
acknowledgment number, and control flags, along with the actual data being transmitted. TCP segments
ensure reliable and ordered delivery of data between devices on a network.
Page 1
TCP SEGMENT
SEGMENT SEGMENTS
SESEGMENT
A TCP segment consists of data bytes to be sent and a header that is added to the data by TCP as shown:
The header of a TCP segment can range from 20-60 bytes. 40 bytes are for options. If there are no options, a header is 20 bytes
else it can be of upmost 60 bytes.
Header fields:
· Sequence Number –
A 32-bit field that holds the sequence number, i.e, the byte number of the first byte that is sent in that particular
segment. It is used to reassemble the message at the receiving end of the segments that are received out of order.
· Acknowledgement Number –
A 32-bit field that holds the acknowledgement number, i.e, the byte number that the receiver expects to receive
next. It is an acknowledgement for the previous bytes being received successfully.
Page 2
TCP SEGMENT
SEGMENT SEGMENTS
SESEGMENT
· 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:
· URG: Urgent pointer is valid
· ACK: Acknowledgement number is valid( used in case of cumulative acknowledgement)
· PSH: Request for push
· RST: Reset the connection
· SYN: Synchronize sequence numbers
· FIN: Terminate the connection
· Window size –
This field tells the window size of the sending TCP in bytes.
· Checksum –
This field holds the checksum for error control. It is mandatory in TCP as opposed to UDP.
· Urgent pointer –
This field (valid only if the URG control flag is set) is used to point to data that is urgently required that needs to
reach the receiving process at the earliest. The value of this field is added to the sequence number to get the byte
number of the last urgent byte.
Page 3
TCP SEGMENT
SEGMENT SEGMENTS
SESEGMENT
Data segmentation in TCP (Transmission Control Protocol) is the process of dividing the data stream into
smaller segments before transmitting it over a network. TCP is a connection-oriented protocol that ensures
reliable and ordered delivery of data between two devices, and data segmentation is a fundamental aspect of
how it accomplishes this. Here's how data segmentation works in TCP:
1. Data Stream: When a higher-layer application (e.g., a web browser) wants to send data over a TCP connection,
it provides a stream of data to the TCP layer. This data is often larger than the Maximum Segment Size (MSS)
that can be accommodated in a single TCP segment.
2. Segmenting: TCP breaks this data stream into smaller segments, known as TCP segments. Each segment contains
a portion of the original data. The size of these segments is determined by the Maximum Segment Size (MSS),
which is negotiated during the TCP handshake. MSS specifies the maximum amount of data that can be sent in
a single segment.
3. Header Information: Each TCP segment contains a header with control information, including source and
destination port numbers, sequence numbers, acknowledgment numbers, control flags (e.g., SYN, ACK, FIN),
and window size. This header information is used for managing the connection and ensuring the reliability of data
transfer.
4. Sending Segments: These segments are then transmitted over the network. The segments may take different
routes through the network and might arrive at the destination out of order due to network congestion, delays, or
other factors.
5. Reassembly: Upon arrival at the destination, the TCP layer reassembles the segments in the correct order. The
sequence numbers in the TCP headers are crucial for this process. If any segments are missing or arrive corrupted,
the receiving TCP stack can request retransmission of those specific segments.
6. Acknowledgment: The receiver sends acknowledgment segments (ACKs) back to the sender to confirm the
successful receipt of data. These ACKs include the acknowledgment number, indicating the next expected
sequence number. If a sender doesn't receive an ACK within a certain timeout, it retransmits the unacknowledged
data.
Data segmentation in TCP helps in optimizing network performance and reliability by efficiently utilizing
available bandwidth, allowing multiple applications to share the network without monopolizing it, and
handling network congestion gracefully. It also ensures that if any data is lost or corrupted during
transmission, it can be retransmitted and reliably delivered to the receiver.
Page 4
TCP SEGMENT
SEGMENT SEGMENTS
SESEGMENT
DATA DIVISION INTO TCP SEGMENTS
Here's a description of how data is divided into TCP segments, including MSS considerations:
1. Data Segmentation:
- Data from the upper-layer application (e.g., HTTP, FTP) is passed down to the TCP layer for transmission.
- The TCP layer breaks down the data into smaller segments to be sent over the network. These segments
are the basic units of data transmission in TCP.
2. MSS Considerations:
- The Maximum Segment Size (MSS) is a parameter negotiated during the TCP handshake between the
two communicating devices. It represents the maximum amount of data that can be included in a single
TCP segment.
- MSS is determined by the sender's and receiver's capabilities and the characteristics of the network path.
It is communicated during the TCP three-way handshake in the TCP options field.
- When determining the MSS, both the sender and receiver consider factors like the Maximum
Transmission Unit (MTU) of the network, which is the maximum packet size that can be transmitted over
the network without fragmentation.
3. Segmentation Process:
- The TCP layer at the sender end takes the data from the upper-layer application and divides it into
segments, ensuring that each segment does not exceed the negotiated MSS.
- If the data from the application is larger than the MSS, it will be segmented into multiple segments, each
with a sequence number to maintain proper ordering.
4. Sequence Numbers:
- Each TCP segment is assigned a sequence number, which helps in reordering the segments at the
receiver's end.
- The sender assigns a unique sequence number to each segment, and this number is used to reassemble the
data in the correct order at the receiver.
5. TCP Header:
- Each segment contains a TCP header with various control information, including sequence numbers,
acknowledgment numbers, source and destination ports, and other control flags.
6. Transmission:
- The segments are then sent over the network to the receiver.
- The receiver acknowledges the receipt of each segment, and if any segments are missing or received out
of order, it requests retransmission to ensure reliable data delivery.
7. Reassembly:
- At the receiver's end, the TCP layer reassembles the received segments based on their sequence numbers,
ensuring that the data is delivered to the upper-layer application in the correct order.
Page 5
TCP SEGMENT
SEGMENT SEGMENTS
SESEGMENT
SYN (Synchronize): The SYN segment is used to initiate a TCP connection. When two devices want to
establish a connection, they exchange SYN segments to synchronize their sequence numbers and negotiate
communication parameters.
ACK (Acknowledgment): The ACK segment is used to acknowledge the receipt of data or to confirm the
successful establishment of a connection. It is often combined with other flags to indicate its specific purpose,
such as ACK-SYN for acknowledging the receipt of the initial SYN segment.
FIN (Finish): The FIN segment is used to initiate the graceful termination of a TCP connection. It signals the
sender's intention to finish the connection and may lead to a series of FIN segments exchanged between both
parties.
RST (Reset): The RST segment is used to reset or abort a TCP connection abruptly. It is typically sent when
there is a problem with the connection, or to reject an attempted connection.
PSH (Push): The PSH segment indicates that the data in this segment should be pushed to the receiving
application immediately, without waiting for a full buffer of data.
URG (Urgent): The URG segment is used to indicate that the data in the segment is urgent and should be
prioritized by the receiver.
Window: The Window segment is used to specify the size of the receive window. It helps in flow control by
indicating how much data the sender can transmit before requiring an acknowledgment.
Data: Data segments carry the actual application data being sent over the TCP connection. These segments
make up the bulk of the data exchanged between the communicating devices.
Checksum: Every TCP segment includes a checksum field to ensure data integrity during transmission. The
checksum is used to detect errors in the segment.
Page 6
TCP SEGMENT
SEGMENT SEGMENTS
SESEGMENT
1. Reliable Data Transfer: TCP segments provide reliable data transmission. The protocol ensures that data is
delivered accurately and in the correct order to the recipient. If a segment is lost or corrupted during transmission, TCP
retransmits it until it is successfully received, ensuring data integrity.
2. Flow Control: TCP uses a window-based flow control mechanism to regulate the rate of data transfer between the
sender and receiver. This prevents network congestion and helps manage data transmission based on the receiver's
capacity to process data.
3. Error Detection: TCP segments include a checksum field that helps in detecting errors in the data. If a segment
arrives with an incorrect checksum, it is considered corrupt and is typically discarded, prompting retransmission.
4. Sequence Numbers: TCP segments use sequence numbers to ensure data is delivered in the correct order. This is
essential for applications like file transfers, where the order of data is crucial.
1. Overhead: TCP segments include additional control information in the header, which can result in increased
overhead compared to other protocols like UDP. This additional overhead can impact network efficiency, particularly
for small data transfers.
2. Latency: The reliability and error-checking mechanisms in TCP can introduce latency into network communication.
This delay can be a disadvantage in real-time applications where low latency is critical, such as VoIP or online gaming.
4. Complexity: TCP is a relatively complex protocol, and its connection management, error recovery, and flow control
mechanisms add to its complexity. This complexity can make it less suitable for resource-constrained devices or simple,
point-to-point communication.
Page 7
TCP SEGMENT
SEGMENT SEGMENTS
SESEGMENT
CONCLUSION
In conclusion, TCP (Transmission Control Protocol) segments play a pivotal role in ensuring reliable data
transmission over computer networks. Despite its many advantages, including reliable data transfer, flow
control, error detection, and sequencing, TCP does come with a set of disadvantages and limitations. These
include overhead, latency, connection-oriented nature, complexity, and conservative congestion control. The
suitability of TCP for a given application or network environment depends on the specific requirements and
trade-offs involved.
Page 8
REFERENCES
· https://chat.openai.com/
· https://www.geeksforgeeks.org/services-and-segment-structure-in-tcp
· https://www.tutorialspoint.com/what-is-the-tcp-segment-header