[TCP / IP] TCP packet header

1. The source and destination ports: occupies 2 bytes, the write source and destination ports, respectively;
2 SEQ ID NO: 4 bytes, TCP byte stream transport connection in each byte numbered sequentially. For example, some packet sequence number field value is 301, and the data carried by the total of 100 fields, is clearly the next segment (if there is any) should start from the data number 401;
3. acknowledgment number: 4 words representing section, is desirable to receive the first data byte of the next packet sequence number of a counterpart. For example, B received a packet sent from A, which is the sequence number field 501, and the data length is 200 bytes, B which indicates the correct receipt of data up to 700 A number transmitted. Thus, B expects to receive next data number A is 701, then B in acknowledgment sent to the A segment of the acknowledgment number is set to 701;
4. offset data header length: four bits, it is noted that the TCP text from the start of the data packet has a TCP segment far;
5. reserved: accounted for 6 reserved for future use, but should be all 0 bits;
6. flag
sync SYN, used to synchronize the serial connection is established . When SYN = 1, ACK = 0, indicates this is a connection request packet, if the agreed connection, the response message should make SYN = 1, ACK = 1;
confirmed the ACK, only when ACK = 1, the acknowledgment number field is valid . TCP provides that all packets of the ACK transmission must be set after the connection;
terminating the FIN, for releasing the connection. When FIN = 1, data indicating the sender of this message has been sent, and release requirements;
emergency the URG, when URG = 1, indicates that the urgent pointer field is valid. In this segment tells the system there is an emergency data;
push PSH, when two application processes for interactive communication is sometimes desirable to be able to receive each other's immediate response after typing a command at the end of the application process, this time will be PSH = 1;
reset RST, when RST = 1, show that serious errors occurred in the connection TCP, the connection must be released, then re-establish the connection;
7. The window size: 2 bytes, referring to notify the recipient, sending the newspaper text you need much space to receive;
8. checksum: 2 bytes representing two parts, the header and the checksum data;
9 emergency pointers: 2 bytes indicating the number of bytes of urgent data segment newspaper;
10. option: variable length, defined a number of other optional parameters.

 

Guess you like

Origin www.cnblogs.com/taoshihan/p/11209466.html