首页 > 其他分享 >学技术学英语:TCP的三次握手和四次挥手

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

时间:2025-01-19 16:03:47浏览次数:3  
标签:ACK 握手 connection TCP server 四次 client FIN

单词

汉语意思

音标

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,连接终止。

标签:ACK,握手,connection,TCP,server,四次,client,FIN
From: https://blog.csdn.net/zfj321/article/details/145242883

相关文章

  • [2025.1.19 JavaSE学习]网络编程-2(netstat指令 && TCP补充)
    netstatnetstat-an:可以查看当前主机网络情况,包括端口监听情况和网络连接情况netstat-an|more:可以分页显示在dos控制台执行Listening表示某个端口在监听如果有一个外部程序(客户端)连接到该端口,就会显示一条连接信息PS:netstat-anb,可以发现,8888端口号在上一节程序运行......
  • ingress-nginx代理tcp使其能外部访问mysql
    一、helm部署mysql主从复制helmrepoaddbitnamihttps://charts.bitnami.com/bitnamihelmrepoupdate helmpullbitnami/mysql 解压后编辑values.yaml文件,修改如下(storageclass已设置默认类)117##@paramarchitectureMySQLarchitecture(`standalone`or`re......
  • Profibus DP转Modbus TCP协议转换网关模块功能详解
    ProfibusDP和ModbusTCP是两种不同的工业现场总线协议,ProfibusDP常用于制造业自动化领域,而ModbusTCP则在工业自动化和楼宇自动化等领域广泛应用。实现ProfibusDP转ModbusTCP功能,通常需要特定的网关设备,以下为你详细介绍:捷米JM-DPM-TCP网关模块这......
  • base中TCP/IP基础学习笔记
    base中的网络模型的学习笔记一.关于TCP/IP网络模型引言对于同一台设备上的进程间通信,有很多种方式,有管道、消息队列、共享内存、信号等方式,对于不同设备上的进程间通信,就需要网络通信,设备是多样的,所以要兼容各种各样的设备,就协商出了一套通用的网络协议。网络协议是分层......
  • linux kernel tcp丢包分析
     现象使用netstat-s能看见如下丢包统计  1352910failedconnectionattempts1352910resetsreceivedforembryonicSYN_RECVsockets 查看netstat的代码https://sourceforge.net/p/net-tools/code/ci/master/tree/ 取的这两个文件:/proc/net/netstat, /pro......
  • 揭秘10种主流PLC在ModbusTCP通信中的速度表现!
    大家好!我是付工。通透!终于把ModbusRTU弄明白了这样看来,ModbusTCP协议太简单了太简单了!C#轻松实现Modbus通信前面给大家介绍了一系列关于Modbus和ModbusTCP的知识。今天给大家来实测一下,对于不同品牌的PLC或板卡实现ModbusTCP通信时,通信速度有多快。一、测试界面我们......
  • 为什么TCP要做成流式协议,而非包?
    TCP被设计成流式协议而非包协议,主要有以下技术方面的原因:适应早期硬件与网络环境:    实现简单:在1970年代,硬件条件有限,如处理器速度慢、内存小等。字节流协议的实现相对简单,允许将控制信息插入字节序列空间,并和有效数据一样期望得到确认,比如SYN、FIN等控制位。这比处理复......
  • TCP 与 HTTP keepalive 关系
    1.概念介绍   TCPkeepalive     TCPkeepalive是一种TCP协议层面的机制。它的主要作用是在TCP连接处于空闲状态时,定期发送探测包来检测连接的对端是否还存活。例如,在一个长时间没有数据传输的TCP连接中,服务器端可能会按照配置好的时间间隔(如每隔7200秒)发送一个TCP......
  • 使用tcpdump 和 Wireshark进行简单TCP抓包分析
     一、tcpdump工具 (一)简介tcpdump是一个命令行的网络数据包分析工具,它允许用户在网络接口上捕获和显示TCP/IP和其他协议的数据包。主要用于在Linux和Unix系统上进行网络故障诊断、安全审计和网络性能分析等。 (二)基本语法常用的基本语法格式为:`tcpdump[-adeflnNOpqSt......
  • 揭秘10种主流PLC在ModbusTCP通信中的速度表现!
    大家好!我是付工。通透!终于把ModbusRTU弄明白了这样看来,ModbusTCP协议太简单了太简单了!C#轻松实现Modbus通信前面给大家介绍了一系列关于Modbus和ModbusTCP的知识。今天给大家来实测一下,对于不同品牌的PLC或板卡实现ModbusTCP通信时,通信速度有多快。一、测试界面我们使用自......