TCP byte stream and transmitted data units but Times segment.
TCP packet structure
Source and destination ports
It occupies 2 bytes, the write source and destination ports, respectively. He tells the host that segment come from and where to transfer (port).
serial number
4 bytes, using the mod operator, numbered sequentially according to each byte of the byte stream is transmitted in a TCP connection.
Acknowledgment number
4 bytes, the first data byte acknowledge receipt of each other under a transmission sequence number of packet segments. For example: if the acknowledgment sequence number = N +1, N represents all data up to have been received correctly.
The reliability of TCP is built on the basis of each data packet is required to acknowledge receipt of the above.
Data Offset
Accounting for 4, it represents the TCP packet header length segments. He pointed out that the distance between the starting position of the TCP packet and TCP segment data starting position.
Retention
Accounting for 6, reserved for future use, currently set to zero.
Emergency URG
When URG = 1, it indicates the urgent pointer field is valid. At this time, the sending TCP urgent data will be inserted into the front of the newspaper text data, change the order of the back, first to ensure the transmission of the emergency needs to be sent. And finally with the use of the urgent pointer.
Acknowledgment ACK
When ACK = 1, Acknowledgment field significant, when ACK = 0, the acknowledgment field is not valid. TCP provides that the connection shall create all segments ACK transmission is set to 1
Push PSH
The recipient receives the TCP PSH = 1, indicating that the message segment is higher than the priority needs to be delivered to the receiving application as soon as possible, without waiting for the entire TCP buffer fills all in the delivery.
RST reset
When RST = 1, represents a TCP connection to a fatal error must immediately release the connection, re-establish a new connection.
Synchronization SYN
If the SYN = 1, it indicates that this is a request to establish a connection.
Termination FIN
Release the connection. When FIN = 1, this represents a data sender needs to send the packet segments have all been sent, the request to disconnect.
window
2 bytes, the field indicates clear that now allow each other to transmit the amount of data that tells the other side of this TCP receive buffer can accommodate the number of bytes of data, so that the sender can control the speed of sending data.
Inspection and
2 bytes, the transmitting side has filled, the receiving end performs a CRC algorithm TCP segment to TCP segment test damage during transmission. If the damage is discarded, two-part test and inspection header and data, which is an important guarantee reliable TCP transport. When checksum calculation, before the need to add dummy segment header 12 bytes.
Urgent Pointer
2 bytes. When URG = 1, urgent pointer makes sense, it indicates the number of bytes of urgent data segment newspaper.