Detailed TCP protocol (a) - TCP is and what message structure

Maps:

Here Insert Picture Description
The next blog content will be expanded according to maps

First, what is the TCP

TCP (Transmission Control Protocol Transmission Control Protocol) is a connection-oriented, reliable, ordered, the transport layer protocol based on byte stream.

1.1 connection-oriented

TCP three-way handshake and four wave should be very familiar with the term. TCP connection and release is completed by the above.

1.1.1 Who is it connected?

Connected to both sides of the communication process
we know that communication is the essence of communication between the application layer, transport layer between the process of receiving (sending) application layer data transport layer protocol if you want to connect, then the process was to complete the connection between the host the communication (exchange of information)

TCP connection by sending host third wave is connected to a process A process to determine the recipient host B, once connected, TCP protocol will allow the application process to both send and receive data (full duplex communications services) at any time, and it will provide the transmission and reception buffer space.

1.1.2 all bi-factory communication given Hanso Engineering communication
  • Full-duplex communication: communication parties can simultaneously transmit and receive information (TCP realization)
  • Half-duplex communication: a communication mode may implement bi-directional communications, but not simultaneously in both directions, alternately turn must be carried out (data link layer)

Example:
Full-duplex communication: we can call when speaking can hear each other speak
half-duplex communication: like walkie-talkies, I sentence you speak

Figure:
Here Insert Picture Description
Half-duplex can also be understood only through the car bridge, full-duplex two-way and one each for the bridge lanes. While the former can live only in one direction, which can be two-way back and forth through time.

TCP uses a full-duplex communication, which is why the three-way handshake to establish a connection, the connection is released four times waving , behind talk about Andrew.

1.2 Reliable

TCP protocol is a protocol based on sliding window , and comprising an integrated measure reliable transport protocol, e.g., error detection, delayed acknowledgment mechanisms, sequence number, retransmission timers, etc., described later blog

1.3 Ordered

Typically processes the application data is divided into data blocks TCP (segment) is transmitted , the general length of the data block according to the maximum segment size (MSS) is set.

Thus only part of the data of the application data from the host B to the host A, the data block transmission must be ordered to ensure the integrity of the application data

1.4 byte stream oriented transport

TCP the above-described data blocks as a series of unstructured byte stream, all data is transmitted according to the transmission data block 8bit data set comprising a large number of groups

1.4.1 byte stream oriented, oriented bit stream, for comparing the character stream

Oriented bit stream
of 8 bits is a set of transmission data
byte stream and
one bit of a set of transmission data
character stream oriented
in tcp programming, network transmission byte stream, a character corresponding to the code stream is the string, so the essence There is no difference.

Two, TCP packet structure and function

2.1TCP message structure

2.1.1 Application of the whole data transmission process encapsulated data format

Located on the transport layer TCP data packets called segments (Segment), also translated segment, the data segment or segments. TCP data from the application layer partition and encapsulated into TCP segments for transmission. TCP segment encapsulated in an IP datagram, and then encapsulated into data link layer frames, as shown below:
Here Insert Picture Description

2.1.2TCP segment consisting of

TCP segment = TCP header + application data
Here Insert Picture Description
in detail under the TCP header composition and function of
Here Insert Picture Description
the function of each component are the profiles, the use will be back Once again, TCP work and composition of the above step is to deal with.

He published 198 original articles · won praise 94 · views 90000 +

Guess you like

Origin blog.csdn.net/shang_0122/article/details/104387269