TCP packet structure network protocol

Source: Internet
Author: User
Tags bit set

TCP packet structure network protocol

TCP packet structure

The Fixed Header length is 20 bytes, and the variable part is 0 ~ 40 bytes. Description of each field:

Source port number: source port, 16 bits, range: 0 ~ 65525.

Target port number: the destination port, 16 bits, with the same range as above.

Sequence number: Data serial number, 32 bits. Each byte in the data stream transmitted in the TCP connection is encoded with a sequence number. The value of the serial number field refers to the sequence number of the first byte of the data sent in this section.

Acknoledgement number: confirmation number, 32 bits. It is the sequence number of the first byte of the data in the next packet segment of the recipient.

Header length: Data offset, 4 bits, in 4 bytes. It indicates how far the packet data is from the beginning of the TCP header (length of the TCP packet header ?).

Reserved: reserved fields (including CWR and ECE in the figure), 6 bits, reserved for future use, currently set to 0 for processing.

URG: URG, 1 bit. When URG = 1, it indicates that the emergency pointer field is valid. It tells the system that there is urgent data in this packet segment and should be transmitted as soon as possible (equivalent to high-priority data ).

ACK: Confirm bits, 1 bit. It is valid only when ACK = 1. When ACK = 0, the confirmation number is invalid.

PSH: Push bit, 1 bit. When the receiver TCP receives the packet segment of push bit set 1, it will be delivered to the receiving application process as soon as possible, instead of waiting until the entire cache is filled up before delivery.

RST: reset bit, 1 bit. When RST = 1, it indicates that a serious error occurred in the TCP connection (for example, due to host crash or other reasons). The connection must be released, then re-establish the transportation connection.

SYN: Synchronous bit, 1 bit. If the synchronous bit SYN is set to 1, this indicates a connection request or connection to receive packets.

FIN: 1 bit to terminate a connection. When FIN = 1, it indicates that the data of the sending end of the message segment has been sent and the transport connection needs to be released.

Window size: the size of the window, 16 bits. The window field is used to control the data volume sent by the recipient, in bytes. The end of the TCP connection determines the size of its receiving window based on the size of the cache space, and then notifies the other end to determine the upper limit of the sending window of the other end.

Checksum: Check and, 16 bits. The range of the test and field check includes the header and data. During the calculation test, a 12-byte pseudo header must be added before the TCP packet segment.

Urgent pointer: The urgent pointer field, which is 16 bits. The urgent pointer specifies the sequence number of the last byte of emergency data in this section.

Options: option field, variable length. The TCP header can have up to 40 bytes of optional information, which is used to pass additional information to the end, or to align other options.

Capture TCP Packets 

[Edit recommendations]

SDN no-layer network and TCP/IP layered network TCP sliding window (queue waiting for confirmation by the other party) protocol re-design the TCP/IP protocol stack to support device mobility [responsible editor: lin TEL :( 010) 68476606]

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: info-contact@alibabacloud.com 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.