TCP Message format

Source: Internet
Author: User

1. TCP Header (image source)

2.

(1) Source Port and destination port

Each occupies 2 bytes, and the 16-bit port number is added with the 32-bit IP address.

(2) serial number

4 bytes. The serial number range is [0, 2 ^ 32-1]. There are 2 ^ 32 (that is, 4294967296) serial numbers. The serial number is calculated using mod 2 ^ 32,Each byte is numbered sequentially.

(3) confirmation number

Indicates the number of the first byte of the data in the next packet segment of the receiver host.

(4) Data offset

Occupies 4 bytes, indicating how far the data starts from the beginning of the TCP packet segment. This is actually the length of the TCP packet segment header. Because the header length is not fixed, the data offset field is necessary.

(5) Reserved

It occupies 6 bytes for future use and is currently set to 0.

(6) URG (urgent)

When URG = 1, it indicates that the message should be transmitted as soon as possible, rather than in the original queuing order. Used with the "emergency Pointer" field. The emergency pointer indicates the sequence number of the last byte of the emergency data in this section, so that the recipient can know the total length of the emergency data.

(7) Confirm ACK

The serial number field is valid only when Ack is set to 1. When Ack is set to 0, the serial number is invalid, which is specified by TCP, after the connection is established, all transmitted packets must be set to 1 with Ack.

(8) Push PSH (push)

When PSH = 1, it indicates that the request is sent to the application layer immediately by the remote TCP, rather than being delivered up after the entire cache is filled up.

(9) reset RST (reset)

When rst = 1, it indicates a serious error. You must release the connection and re-establish the transmission connection. Reset bits are also used to deny an illegal message segment or to open a connection.

(10) Synchronization)

Used to establish a connection. When SYN is set to 1 and Ack is set to 0, this indicates a connection request packet segment. If the other party agrees to establish a connection, use SYN = 1 and ACK = 1 in the sent packets. Therefore, SYN = 1 indicates a connection request or connection to receive packets, and the ACK value is used to identify which packets are sent.

(11) terminate fin (Finis, which means "final", "final ")

Used to release a connection. When fin = 1, it indicates that the byte string to be sent has been sent and the transmission connection must be released.

(12) window

2 bytes, indicating the Receiving Window of the sender of the message segment, in bytes. This window tells the recipient, "the maximum number of bytes of data that you can send before receiving my confirmation is the size of this window ."

Notification Window advertised window: The Window value promised by the receiving end based on its receiving capability, which is the traffic control from the receiving end. The receiving end places the value of the notification window in the header of the TCP Message and sends it to the other party.

Congestion window: The Window value obtained by the sending end based on network congestion, and the traffic control from the sending end.

(13) Inspection

Occupies 2 bytes, covering the entire TCP packet segment: TCP header and TCP data. This is a mandatory field, which is calculated and stored by the initiator and verified by the receiver.

(14) Emergency pointer

The emergency pointer makes sense only when URG = 1. It indicates the number of bytes of emergency data in this section (after the emergency data ends, it is common data). Therefore, the emergency pointer specifies the position of the end of the emergency data in the packet segment. When all the emergency data is processed, TCP will tell the application to resume normal operation. It is worth noting that, you can send emergency data even if the window is 0.

(15) Option

Allow each host to set the maximum TCP load capacity acceptable (536 bytes by default)

 

TCP Message format

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.