学技术学英语:TCP的三次握手和四次挥手

news/2025/1/22 21:24:10/

单词

汉语意思

音标

acknowledge

承认,确认

/əkˈnɒl.ɪdʒ/

acknowledgment

确认,承认

/əkˈnɒl.ɪdʒ.mənt/

duplex

双向的

/ˈdjuː.pleks/

establish

建立

/ɪˈstæb.lɪʃ/

handshake

握手,握手协议

/ˈhænd.ʃeɪk/

re-transmission

重传

/ˌriː.trænsˈmɪʃ.ən/

receiver

接收者

/rɪˈsiː.vər/

reliable

可靠的

/rɪˈlaɪ.ə.bəl/

sequence

序列,顺序

/ˈsiː.kwəns/

segment

段,片段

/ˈseg.mənt/

synchronize

同步

/ˈsɪŋ.krə.naɪz/

termination

终止,结束

/ˌtɜː.mɪˈneɪ.ʃən/

transmit

传输

/trænzˈmɪt/

transmitter

发送者

/trænzˈmɪt.ər/

synchronize

同步

/ˈsɪŋ.krə.naɪz/

termination

终止,结束

/ˌtɜː.mɪˈneɪ.ʃən/

handshake

握手,握手协议

/ˈhænd.ʃeɪk/

duplex

双向的

/ˈdjuː.pleks/

acknowledgment

确认,承认

/əkˈnɒl.ɪdʒ.mənt/

retransmission

重传

/ˌriː.trænsˈmɪʃ.ən/

TCP Connection (A 3-way handshake)

Handshake refers to the process to establish connection between the client and server. Handshake is simply defined as the process to establish a communication link. To transmit a packet, TCP needs a three way handshake before it starts sending data. The reliable communication in TCP is termed as PAR (Positive Acknowledgement Re-transmission). When a sender sends the data to the receiver, it requires a positive acknowledgement from the receiver confirming the arrival of data. If the acknowledgement has not reached the sender, it needs to resend that data. The positive acknowledgement from the receiver establishes a successful connection.

Here, the server is the server and client is the receiver. The above diagram shows 3 steps for successful connection. A 3-way handshake is commonly known as SYN-SYN-ACK and requires both the client and server response to exchange the data. SYN means synchronize Sequence Number and ACK means acknowledgment. Each step is a type of handshake between the sender and the receiver.

The diagram of a successful TCP connection showing the three handshakes is shown below:

The three handshakes are discussed in the below steps:

Step 1: SYN

SYN is a segment sent by the client to the server. It acts as a connection request between the client and server. It informs the server that the client wants to establish a connection. Synchronizing sequence numbers also helps synchronize sequence numbers sent between any two devices, where the same SYN segment asks for the sequence number with the connection request.

Step 2: SYN-ACK

It is an SYN-ACK segment or an SYN + ACK segment sent by the server. The ACK segment informs the client that the server has received the connection request and it is ready to build the connection. The SYN segment informs the sequence number with which the server is ready to start with the segments.

Step 3: ACK

ACK (Acknowledgment) is the last step before establishing a successful TCP connection between the client and server. The ACK segment is sent by the client as the response of the received ACK and SN from the server. It results in the establishment of a reliable data connection.

After these three steps, the client and server are ready for the data communication process. TCP connection and termination are full-duplex, which means that the data can travel in both the directions simultaneously.

TCP Termination (A 4-way handshake)

Any device establishes a connection before proceeding with the termination. TCP requires 3-way handshake to establish a connection between the client and server before sending the data. Similarly, to terminate or stop the data transmission, it requires a 4-way handshake. The segments required for TCP termination are similar to the segments to build a TCP connection (ACK and SYN) except the FIN segment. The FIN segment specifies a termination request sent by one device to the other.

The client is the data transmitter and the server is a receiver in a data transmission process between the sender and receiver. Consider the below TCP termination diagram that shows the exchange of segments between the client and server.

The diagram of a successful TCP termination showing the four handshakes is shown below:

Let's discuss the TCP termination process with the help of six steps that includes the sent requests and the waiting states. The steps are as follows:

Step 1: FIN

FIN refers to the termination request sent by the client to the server. The first FIN termination request is sent by the client to the server. It depicts the start of the termination process between the client and server.

Step 2: FIN_ACK_WAIT

The client waits for the ACK of the FIN termination request from the server. It is a waiting state for the client.

Step 3: ACK

The server sends the ACK (Acknowledgement) segment when it receives the FIN termination request. It depicts that the server is ready to close and terminate the connection.

Step 4: FIN _WAIT_2

The client waits for the FIN segment from the server. It is a type of approved signal sent by the server that shows that the server is ready to terminate the connection.

Step 5: FIN

The FIN segment is now sent by the server to the client. It is a confirmation signal that the server sends to the client. It depicts the successful approval for the termination.

Step 6: ACK

The client now sends the ACK (Acknowledgement) segment to the server that it has received the FIN signal, which is a signal from the server to terminate the connection. As soon as the server receives the ACK segment, it terminates the connection.

中文总结:

  • TCP连接建立(三次握手):

    • SYN(同步序列号):客户端向服务器发送连接请求。

    • SYN-ACK:服务器回应,确认收到请求并准备连接。

    • ACK(确认):客户端确认服务器的响应,连接建立。

  • TCP连接的特点:

    • 使用PAR(Positive Acknowledgement with Retransmission)来确保可靠通信。

    • 连接是双向的(全双工),数据可以同时双向传输。

  • TCP连接终止(四次握手):

    • FIN(终止请求):客户端发出终止连接的请求。

    • FIN_ACK_WAIT:客户端等待服务器的ACK。

    • ACK:服务器确认收到FIN请求。

    • FIN_WAIT_2:客户端等待服务器的FIN信号。

    • FIN:服务器发送FIN信号,表示准备终止连接。

    • ACK:客户端确认收到FIN,连接终止。


http://www.ppmy.cn/news/1565311.html

相关文章

我的2024:创作历程与成长总结

2024年是一个值得回顾与总结的一年。这一年里,我在多个技术领域和创作方向上不断尝试与突破,完成了一系列内容创作。从个人成长到社区参与,每一步都凝聚着努力与热爱。在这篇文章中,我将对这一年的创作历程进行总结盘点&#xff0…

消息队列篇--原理篇--Pulsar(Namespace,BookKeeper,类似Kafka甚至更好的消息队列)

Apache Pulusar是一个分布式、多租户、高性能的发布/订阅(Pub/Sub)消息系统,最初由Yahoo开发并开源。它结合了Kafka和传统消息队列的优点,提供高吞吐量、低延迟、强一致性和可扩展的消息传递能力,适用于大规模分布式系…

RabbitMQ--延迟队列

(一)延迟队列 1.概念 延迟队列是一种特殊的队列,消息被发送后,消费者并不会立刻拿到消息,而是等待一段时间后,消费者才可以从这个队列中拿到消息进行消费 2.应用场景 延迟队列的应用场景很多,…

【opencv】第10章 角点检测

第10章 角点检测 10.1 Harris角点检测 10.1.1 兴趣点与角点 在图像处理和与计算机视觉领域,兴趣点(interest points),也被称作关键点 (key points)、特 征 点(feature points)。它被大量用于解决物体识别、图像识别、 图像匹配、视觉跟踪、三维重建等一系列的问题…

三天急速通关Java基础知识:Day1 基本语法

三天急速通关JAVA基础知识:Day1 基本语法 0 文章说明1 关键字 Keywords2 注释 Comments2.1 单行注释2.2 多行注释2.3 文档注释 3 数据类型 Data Types3.1 基本数据类型3.2 引用数据类型 4 变量与常量 Variables and Constant5 运算符 Operators6 字符串 String7 输入…

如何使用CRM数据分析优化销售和客户关系?

嘿,大家好!你有没有想过为什么有些公司在市场上如鱼得水,而另一些却在苦苦挣扎?答案可能就藏在他们的销售策略和客户关系管理(CRM)系统里。今天我们要聊的就是如何通过有效的 CRM 数据分析来提升你的销售额…

寒假刷题Day11

一、2516. 每种字符至少取 K 个 class Solution { public:int takeCharacters(string s, int k) {int cnt[3]{};for (char c : s){cnt [c - a];}if (cnt[0] < k || cnt[1] < k || cnt[2] < k) {return -1; // 字母个数不足 k}int mx 0, left 0;for(int right 0; r…

机器学习有哪些应用场景

机器学习的应用场景非常广泛&#xff0c;涵盖了各个行业和领域。以下是一些主要的应用场景&#xff1a; 一、图像和视觉识别 人脸识别&#xff1a;用于解锁手机、自动标记照片、监控安全系统&#xff0c;以及门禁系统、考勤系统、人脸识别防盗门、电子护照及身份证等。此外&a…