TCP header structure

 

source port

A 16-bit field that defines the port number of the application in the host that sent this segment.

 

destination port

A 16-bit field that defines the port number of the application in the host that receives this segment.

 

sequence number

A 32-bit field that defines the number assigned to the first data byte of this segment. To ensure connectivity, each byte to be sent is numbered. The sequence number tells the endpoint which byte in the sequence the first byte in the segment is. When establishing a connection, both parties use their respective random number generators to generate an initial squence number (ISN). Usually, the ISNs in the two directions are different.

 

acknowledgment nimber

The 32-bit field defines the byte encoding that the receiver of the segment expects to receive from the peer. If the receiver of the segment successfully receives the byte numbered x from the other party, it returns x+1 as the acknowledgment number, acknowledging that it can be piggybacked with the data.

 

 

Header length (Hlen)

This 4-byte field indicates the length of the header of the TCP segment, measured as a 32-bit field. The length of the header is not specified and can be changed according to the parameters set in the options field.

 

reserved

This reserved field occupies 6 bits and is reserved for future use.

 

code bits

URG urgent data (urgent data) - this is an urgent message

ACK acknowledges segment received

PSH requests to send a message when the buffer is not full. Note that TCP can wait for the buffer to fill before sending a segment. If it needs to be sent immediately, the application must use the push parameter to notify the protocol.

RST request to reset the connection

SYN This message is used to synchronize a timer for transferring data when a connection is established.

FIN This attribute declares that the sender has sent the last byte of the transmitted data.

 

window size

16-bit field, this field defines the size of the sending TCP window, in bytes. The maximum length of the window is 65535 bytes. This value is usually called the receive window (rwnd) and is determined by the receiver. In this case, the sender must obey the instructions of the receiver.

 

checksum

The 16-bit field contains the checksum, which is one of the means of error control.

 

urgent point

This field occupies 2 bytes, is used with the URG code bit and declares the end of data that must be received urgently even in the event of a buffer overflow. Therefore, if some data needs to be sent to the destination application out of sequence, the sending application must notify TCP with the urgent data parameter.

 

option

This field is variable length and can be ignored. Its maximum length is 3 bytes, and it is used to solve some auxiliary tasks - for example, choosing the maximum segment length. Options can be at the end of the TCP header, and their length must be a multiple of 8.

 

 

padding

The length of this field is not fixed, it is a dummy field used to supplement the header field so that its length is an integer multiple of 32-bit words.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326402523&siteId=291194637
Recommended