当前位置:网站首页>What is the TCP 3-time handshake process?
What is the TCP 3-time handshake process?
2022-06-27 11:50:00 【long_ songs】
Now we mainly use TCP( Transmission control protocol ) Data transmission in a connection oriented network . But have you ever thought about it , Why do we prefer TCP Not any other agreement ?
actually ,TCP It provides us with a safe and reliable connection link between the two devices . and , This only occurs during the establishment and closing of a connection between two devices TCP Medium 3 Only during the first handshake . seeing the name of a thing one thinks of its function , There are three steps to establishing and closing a connection . therefore , In this blog , We will understand TCP 3 The second handshake process and the different steps involved .
TCP 3 The handshake process
3-Way Handshake The process is TCP A set of defined steps that occur in , Used to create a secure and reliable communication link and close it . actually ,TCP Use before transferring data 3 The second handshake process establishes a connection between two devices . Once the connection is established , Data transmission between devices . Then you need to terminate the connection , This is also done by using 3 The second handshake process is completed . A secure and reliable connection is established to preserve the equipment CPU、 Buffer and bandwidth to communicate normally . therefore , These resources must be released by terminating the connection after data transmission . therefore , have access to TCP 3 The second handshake process establishes and terminates the connection in the network in a secure way .
Here is TCP Figure displaying the header .

TCP There are some elements in the header file for 3 The handshake process , They are :
- Serial number : The serial number is a random 32 position ( The scope is 0 To (2^32 -1)) The number of , Assigned to the first bit of data . Usually , A serial number is used only once in a connection . For other data transfers in the same connection , Other random serial numbers can be used .
- Confirmation no. : It is the next serial number that the sending device expects from the sender . It is usually larger than the serial number received from the sender 1.
- Window size : The window size is the buffer size . It is the maximum amount of data that can be received in the buffer .
- Maximum segment size : It is the maximum size of each data segment that the connecting device can accept . Over this size , The device will not be able to receive data segments .
- SYN sign : SYN On behalf of the synchronization . It can be described as a request to establish a connection . If SYN by 1, It means that the device needs to establish a secure connection , Otherwise not .
- ACK sign : ACK The representative confirmed . Can be said to be SYN Response . If ACK by 1, The device has received SYN Message and confirm , Otherwise no .
- FIN sign : FIN The representative has completed . When the data transmission is complete , The device has to use FIN Flag to terminate the connection . If FIN by 1, Then the device will terminate the connection , Otherwise not .
Here's how to use 3 Figure displaying how to establish a connection during the second handshake .

Here are the USES TCP Medium 3 The three steps involved in establishing a connection in the second handshake process :
- The client sends to the server SYN: When the client wants to connect to the server . It will “SYN” Flag set to 1 And send the message to the server . This message has some additional information , Like serial number ( Any random 32 Digit number )、 Here ACK Set to 0、 Window size and maximum segment size . for example , If the window size is 2000 position , The maximum segment size is 200 position , At most... Can be transmitted in the connection 10 Data segments (2000/200 = 10).
- The server replies to the client SYN and ACK: After the server receives the synchronization request from the client , By way of ACK Flag set to “1” Send a confirmation to the client .ACK The confirmation number of is one greater than the received serial number . for example , If the client sends a serial number = 1000 Of SYN, Then the server will send a confirmation number = 10001 Of ACK. Besides , Server will SYN Flag set to “1” And send it to the client , If the server also wants to establish a connection . Here for SYN The serial number of will be the same as that of the client SYN Different . The server also notifies the client of its window size and maximum segment size . When this is done , The client to server connection is established .
- The client sends to the server ACK: client Received from the server SYN after , take ACK Flag set to '1', And greater than the server SYN Serial number confirmation number 1 Send to client . ad locum ,SYN The flag remains “0”. After completing this step , Now the connection from the server to the client is also established . Once the connection is established , The minimum of the maximum segment sizes of the sender and receiver will be considered for data transmission .
Here's how to use 3 Figure displaying how the secondary handshake process terminates the connection .

Here are the USES TCP Medium 3 The third handshake process involves three steps to terminate the connection :
- The client sends to the server FIN: When the client wants to terminate the connection . It will FIN Flag set to “1”, And use the random serial number to send the message to the server . here ,ACK Set to 0.
- The server replies to the client FIN and ACK: After the server receives the termination request from the client , By way of ACK Flag set to “1” Send a confirmation to the client .ACK The confirmation number of is one greater than the received serial number . for example , If the client sends a serial number = 1000 Of FIN, Then the server will send a confirmation number = 10001 Of ACK. Besides , Server will FIN Flag set to “1” And send it to the client , If the server also wants to terminate the connection . Here for FIN The serial number of will be the same as that of the client FIN Different . After completing this step , The connection from the client to the server is terminated .
- The client sends to the server ACK: client Received from the server FIN after , take ACK Flag set to '1', And with a larger than the server FIN Serial number confirmation number 1 Send to client . here ,FIN The flag remains “0”. After completing this step , The connection from the server to the client is now terminated .
This is about TCP Used in the protocol 3 The whole contents of the second handshake process and its steps .
边栏推荐
- Prevent being rectified after 00? I. The company's recruitment requires that employees cannot sue the company
- Wait, how do I use setmemorylimit?
- After Jerry's sleep, the regular wake-up system continues to run without resetting [chapter]
- Detailed explanation of interprocess communication
- Popular science of device review: popular science of innovative medical device series - sternum plate products
- [tcapulusdb knowledge base] Introduction to tcapulusdb data import
- 面试突击60:什么情况会导致 MySQL 索引失效?
- Mqtt protocol stack principle and interaction flow chart
- Jerry's DAC output mode setting [chapter]
- [tcapulusdb knowledge base] tcapulusdb doc acceptance - create business introduction
猜你喜欢

Summary of qstype class usage (III)

One copy ten, CVPR oral is accused of plagiarizing a lot

政策关注 | 加快构建数据基础制度,维护国家数据安全

MQTT协议栈原理及交互流程图

Open source model library of flying propeller industry: accelerating the development and application of enterprise AI tasks

Salesforce 容器化 ISV 场景下的软件供应链安全落地实践
![[tcapulusdb knowledge base] tcapulusdb operation and maintenance doc introduction](/img/04/b1194ca3340b23a4fb2091d1b2a44d.png)
[tcapulusdb knowledge base] tcapulusdb operation and maintenance doc introduction

pull request

面试突击60:什么情况会导致 MySQL 索引失效?

Redis 分布式锁15问,看看你都掌握了哪些?
随机推荐
Summary of qstype class usage (II)
Unity Shader学习(二)第一个Shader
Informatics Olympiad all in one 1332: [example 2-1] weekend dance
Co jump
VPT Model Video Explanation
【TcaplusDB知识库】Tmonitor系统升级介绍
【TcaplusDB知识库】TcaplusDB系统管理介绍
面试突击60:什么情况会导致 MySQL 索引失效?
巅峰小店APP仿站开发玩法模式讲解源码分享
力扣(LeetCode)177. 第N高的薪水(2022.06.26)
杰理之添加定时器中断【篇】
Unity Shader学习(一)认识unity shader基本结构
[tcaplusdb knowledge base] Introduction to tcaplusdb tcaplusadmin tool
Code for structural design of proe/creo household appliances - electric frying pan
Leetcode 729. My schedule I (awesome, solved)
15+ urban road element segmentation application, this segmentation model is enough!
21: Chapter 3: develop pass service: 4: further improve [send SMS, interface]; (in [send SMS, interface], call Alibaba cloud SMS service and redis service; a design idea: basecontroller;)
Codeforces Round #786 (Div. 3) ABCDE
Codeforces Round #786 (Div. 3) ABCDE
Deep understanding of happens before principle
