Those things about TCP (on)

TCP is a hugely complex protocol because he has to solve a lot of problems, and these problems bring out a lot of sub-problems and dark side. So learning TCP itself is a painful process, but it can make people have a lot of gains in the process of learning. Regarding the details of the TCP protocol, I still recommend you to see W. Richard Stevens' "TCP/IP Explain 1: Protocol" (of course, you can also read RFC793 and the N more RFC). In addition, I will use English terminology in this article, so that you can find relevant technical documents through these English keywords.

The reason why I want to write this article has three purposes.

One is to try to exercise whether you can use a simple space to describe such a complex TCP protocol.

The other is that many programmers nowadays basically don't read the book seriously and like the fast food culture. Therefore, I hope this fast food article will let you know about the classical technology of TCP and understand the software design. All kinds of difficulties. And you can get some software design gains from it.

The most important hope is that this basic knowledge will allow you to figure out a lot of plausible things in the past, and you can realize the importance of the foundation.

Therefore, this article will not cover everything, just the science of TCP protocols, algorithms and principles.

I originally only wanted to write a length of article, but TCP is really complicated TMD, more complicated than C++. Over the past 30 years, various optimization variants have been debated and modified. Therefore, writing and writing found that only cut into two.

In the previous article, I mainly introduced you to the definition of TCP protocol and the retransmission mechanism when dropping packets.

In the next section, we focus on TCP's aliasing and congestion handling.

Less nonsense, first of all, we need to know the fourth layer of TCP in the seven-layer model of network OSI - Transport layer, IP in the third layer - Network layer, ARP in the second layer - Data Link layer, in the first The data on the second layer, we call Frame, the data on the third layer is called Packet, and the data on the fourth layer is called Segment.

First of all, we need to know that the data of our program will first hit the TCP Segment, then the TCP Segment will hit the IP Packet, and then hit the Ethernet Ethernet Frame, after passing to the peer, the layers Parse your own protocol and then pass the data to a higher level protocol.

TCP header format

Next, let's take a look at the format of the TCP header.

Those things about TCP (on)

TCP header format (image source)

You need to pay attention to these points:

The TCP packet has no IP address, which is the IP layer. But the active port and the target port.

A TCP connection requires four tuples to indicate that the same connection (src_ip, src_port, dst_ip, dst_port) is exactly a five-tuple, and one is a protocol. But because this is just a TCP protocol, I only talk about quads here.

Notice the four very important things in the picture above:

The Sequence Number is the sequence number of the packet and is used to solve the network packet reordering problem.

The Acknowledgement Number is the ACK - used to acknowledge receipt, to solve the problem of not losing packets.

Window is also called AdverTIsed-Window, which is also known as the sliding window, which is used to solve flow control.

TCP Flag, which is the type of packet, is mainly used to manipulate the state machine of TCP.

For other things, see the illustration below

Those things about TCP (on)

TCP state machine

In fact, the transmission on the network is not connected, including TCP is the same. The so-called "connection" of TCP is actually just to maintain a "connection state" on both sides of the communication, so that it looks like there is a connection. Therefore, the state transition of TCP is very important.

The following is: "TCP state machine" (picture source) and "TCP link", "TCP break link", "pass data" comparison chart, I put the two maps together and so that it is convenient for you to compare Look. In addition, the two figures below are very, very important, you must remember. (Spit a trough: Seeing such a complicated state machine, you know how complicated this protocol is. Complex things always have a lot of pits, so the TCP protocol is actually quite awkward.)

Those things about TCP (on)

Many people will ask why it takes 3 handshakes to build a link, and 4 waves to break a link?

For the 3-way handshake of the built link, it is mainly to initialize the initial value of the Sequence Number. The two parties to the communication should notify each other of their own initialization Sequence Number (abbreviated as ISN: Inital Sequence Number) - so called SYN, the full name Synchronize Sequence Numbers. This is the x and y in the figure above. This number is to be used as the serial number of the future data communication to ensure that the data received by the application layer will not be out of order due to the transmission problem on the network (TCP will use this serial number to splicing the data).

AC Power Supply

APM AC power supply provides powerful test and analysis features all in a comparatively compact and light-weight box. Offer stable,reliable power with models available up to 5000 VA. The variable ac power supply is capable of delivering up to 6 times of peak current compared to its maximum rated current that makes it ideal for inrush current test.The adjustable ac power supply is adopted high speed DSP+CPLD control, high frequency PWM power technology and active PFC design to realize AC/DC stable output.

The ac source is featured with high power density, high reliability and high precision, meanwhile it possesses operation interface of touch screen and keys manually. It is able to analog output normal or abnormal input for electrical device to meet test requirements.

Some features as below:


  • 5.6" large touch color screen
  • AC+DC mixed or independent output mode
  • Capable of setting output slope/phase angle
  • Built-in IEC standard test function
  • Built-in multiple protections
  • Built-in power meter
  • Support impedance function
  • Support for LIST/PULSE/STEP mode & Transient mode
  • Standard RS232/RS485/USB/LAN, Optional GPIB/multiphase card.
  • Support master and slave parallel mode to realize power extension
  • Support harmonics/inter-harmonics simulation and measuring function
  • Support for USB data import/export and scree nap from front panel
  • PWM technologies, with up to 86% efficiency
  • CE, CSA, UL, ROHS Certified


Ac Power Supply,Game Power Supply,AC Power Source,Led Power Supply

APM Technologies Ltd , https://www.apmpowersupply.com