TCP/IP Protocol--TCP protocol

Source: Internet
Author: User

TCP provides a connection-oriented, reliable byte-stream service.
Connection-oriented means that the sending and receiving parties must establish a TCP connection before exchanging data. By the way, a TCP connection has only two sides, so broadcast and multicast cannot be applied to TCP.
The byte stream refers to two applications that exchange a byte stream of 8bit bytes over a TCP connection.
Reliability:
1. The application data is segmented into the data block that TCP considers most suitable for sending. TCP-to-IP call segment, also called segment segment
2. When TCP sends a segment, start a timer and wait for the destination to acknowledge receipt. If not received in time, the sender will resend the message segment.
3. The receiving side receives the TCP data and sends a confirmation. Not sent immediately, a few seconds to postpone.
4. TCP will maintain the checksum of its header and data. End-to-end checksum.
5. Because IP datagrams can be duplicated, TCP discards duplicates.
6. TCP also has flow control. The TCP receiver has a buffer, and the sender does not emit more than the buffer until the buffer has space to avoid overflow.

TCP Header: TCP packets are also dependent on the IP datagram. The TCP header is similar to the IP header length, not the option length, which is 20 bytes.

TCP Header

1. Start with two 16bit source port and destination port. Used to differentiate user processes. These two and two IP addresses of the IP header together determine a connection to TCP.
2.32bit Serial Number: The serial number is used to identify the data byte stream from the TCP originator to the receiving end, representing the first data bytes in this segment. Similar to TCP counts each byte with an ordinal number.
When a new connection is established, there is a isn initial sequence number, and the first byte ordinal to be sent by the host is isn+1.
3. Confirm serial number of 32bit: Confirm that the serial number includes the next serial number expected by the receiving end.
4.4bit length, indicating a maximum of 60 bytes (1 bit for 32bit length) and IP header
5.
URG: Emergency pointer valid
ACK: Confirm serial number is valid
PSH: The receiver is delivered to the application push as soon as possible
RST: Re-establish the connection
SYN: The synchronous sequence number is used to initiate a connection
FIN: The originator completes the task

6.16bit window Size: TCP Traffic control is the use of this window size. The window size is the number of bytes.
7.16bit inspection and: first and data inspection and. Similar to the UPD, a pseudo-header support calculation is required.
8.16bit Emergency pointer: The emergency hand is only valid if the Urg is 1.
9. Options: The most common is the longest message size, also known as MSS, usually specify this option in the first message segment of the communication.
10. Data section: This is not the first content. A TCP message segment does not necessarily require data. For example, when the connection is established, there is no data, only the head is transmitted.

TCP/IP Protocol--TCP protocol

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.