TCP Data Segment format

Source: Internet
Author: User

The Transmission Control Protocol (TCP) is usually from the applicationProgramAnd then split it into several data segments. TCP numbers and sorts the data segments. In this way, the data segments can be re-formed into the original application data structure only on the destination's TCP protocol stack. Because TCP uses the virtual circuit connection mode, after these data segments are sent out, the sender's TCP will wait for the receiver's TCP to give a confirmation response, data segments that do not receive a confirmation response will be resent.

When the sender's host starts to send data segments down the layered model, the sender's TCP protocol notifies the target's TCP protocol to establish a connection, which is also called a virtual circuit. This communication method is called connection-oriented
. During the initial handshake negotiation, the TCP layer of both parties must reach an agreement on the number of messages that the receiver can send continuously before returning a confirmation response. The channels used for reliable transmission are established with the depth of the negotiation process.

TCP is a fully-duplex, connection-oriented, reliable, and precisely controlled protocol, but all these conditions and environments should be established with error control, it is not a simple task. Therefore, there is no doubt that TCP is complex and expensive in terms of network overhead. However, because network transmission can provide higher reliability compared with previous networks, the reliability attached to TCP is not necessary.

The TCP Header consists of 24 bytes:


Source Port Number (16bit) Destination Port Number (16bit)
Serial number (32bit)
Confirm the response number (32bit)
Header Length (4) Reserved (6) CodeBITs (6) Window (16)
Checksum (16) Emergency (16)
Option (0 or 32, if any)

Data (variable)

Destination Port NumberThe Port Number of the request application on the target host.
Serial numberA sequence in which TCP is used to orchestrate data back to the original correct s or to re-transmit the lost or damaged data. Such a process is called Sequence Control (sorting ).
Confirm answer numberDescribes the next TCP eight-bit group of data to be received.
Header LengthThe number of 32-bit characters contained in the TCP header. Used to specify the starting position of the data. The length of the TCP Header (even if it contains an option) is a 32-bit integer multiple.
RetainedAlways set to zero.
Code bitThis API is used to set up and end sessions.
WindowIt is the size of the sending window that the sender will be allowed to send, expressed in octal form.
ChecksumCyclic Redundancy check (CRC) does not trust the lower layer of TCP, so all data is checked. This CRC is used to check the header and data fields.
UrgentWhen the emergency pointer code bit is set as a valid field, if it is valid, This value specifies the Offset Value of the Eight-bit Group of the current serial number, that is, the starting position of the first non-emergency data.
OptionIt can be a multiple of 0 or 32 bits as needed. That is to say, if no option exists, the option size is 0. However, if the field used by the option is not an integer multiple of 32 bits, you need to fill in several zeros to ensure that the data starts at the 32-bit boundary.
DataIt refers to the data transmitted to the transport layer TCP protocol, which contains the header of the upper layer data.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.