http://www.tcpipguide.com/free/t_TCPConnectionTermination-4.htm
TCP Connection Termination
(Page 4 of 4)
Simultaneous Connection Termination
Just as it is possible for the normal connection establishment process to be changed if two devices decide to actively OPEN a connection to each other, it is also possible for two devices to try to terminate a connection simultaneously. This term “simultaneously” doesn't mean that they both decide to shut down at exactly the same time—variances in network delays mean nothing can be simultaneous on an internetwork anyway. It simply means that, in the example above, the client decides to shut down and sends a FIN, but the server sends its own FIN before the client's FIN shows up at the server. In that case, a different procedure is followed, as described in Table 155 and Figure 215.
As you can see, the process is much more symmetric in this case, with both devices transitioning through the same states. In either case the end result is the same, with the connection in the CLOSED state—meaning no connection. Each TCP will make sure all outstanding data is sent to the application, sometimes referred to as an implied “push” (see the description of the “push” function for an explanation of this term). The transmission control blocks (TCBs) established for the connection in both devices are destroyed when the connection is closed down.
Table 155: TCP Simultaneous Connection Termination Procedure
Client
|
|
|
Server
|
|
|
Start State
|
Action
|
Transitions To State
|
Start State
|
Action
|
Transitions To State
|
ESTABLISHED
|
Client Close Step #1 Transmit: The application using TCP signals that the connection is no longer needed. The TCP on the client sends the next segment with the FIN bit set, indicating a request to close the connection.
|
FIN-WAIT-1
|
ESTABLISHED
|
Server Close Step #1 Transmit: Before the server can receive the FIN sent by the client, the application on the server also signals a close. The server also sends a FIN.
|
FIN-WAIT-1
|
FIN-WAIT-1
|
Server Close Step #1 Receive and Step #2 Transmit: The client has sent a FIN and is waiting for it to be acknowledged. Instead, it receives the FIN sent by the server. It acknowledges the server's close request with an ACK and continues to wait for its own ACK.
|
CLOSING
|
FIN-WAIT-1
|
Client Close Step #1 Receive and Step #2 Transmit: The server has sent a FIN and is waiting for it to be acknowledged. Instead, it receives the FIN sent by the client. It acknowledges the client's close request with an ACK and continues to wait for its own ACK.
|
CLOSING
|
CLOSING
|
Client Close Step #2 Receive: The client receives the ACK for its FIN.
|
TIME-WAIT
|
CLOSING
|
Server Close Step #2 Receive: The server receives the ACK for its FIN.
|
TIME-WAIT
|
TIME-WAIT
|
The client waits for a period of time equal to double the maximum segment life (MSL) time. This gives enough time to ensure the ACK it sent to the server was received.
|
—
|
TIME-WAIT
|
The server waits for a period of time equal to double the maximum segment life (MSL) time. This gives enough time to ensure the ACK it sent to the client was received.
|
—
|
TIME-WAIT
|
The timer expires after double the MSL time.
|
CLOSED
|
TIME-WAIT
|
The timer expires after double the MSL time.
|
CLOSED
|
CLOSED
|
The connection is closed.
|
—
|
CLOSED
|
The connection is closed.
|
—
|
Figure 215: TCP Simultaneous Connection Termination Procedure
Under certain circumstances both devices may decide to terminate a connection simultaneously, or nearly simultaneously. In this case each sends a FIN and before getting an ACK for it, receives the other device’s FIN. Each acknowledges the other’s FIN and waits for a period of time before closing the connection. Note the transition through the CLOSING state, which is only used as part of simultaneous termination.
|
Key Concept: Just as two devices can simultaneously open a TCP session, they can terminate it simultaneously as well. In this case a different state sequence is followed, with each device responding to the other’s FIN with an ACK, waiting for receipt of its own ACK, and pausing for a period of time to ensure that its ACK is received by the other device before ending the connection.
|
分享到:
相关推荐
- **TCP Connection Termination**:TCP连接的终止分为正常终止和异常终止两种情况。 - **正常终止步骤**: 1. 客户端发送一个FIN段来关闭连接。 2. 服务器接收到FIN后,发送ACK确认。 3. 服务器发送自己的FIN...
7. **连接终止(Connection Termination)**:TCP连接的结束采用四次挥手(Four-Way Handshake)。双方分别发送FIN(结束)标志来通知对方数据发送完毕,然后等待对方的ACK确认,直到双方都确认无数据待传输,连接才...
5. **断开连接(Connection Termination)**:当数据传输完成后,双方会通过四次挥手(Four-Way Handshake)来关闭连接,释放资源。 在提供的压缩包中,"tcp_serv.py"很可能是一个Python程序,用于实现上述的TCP...
4. **Connection Establishment and Termination**: Establishing a connection before data transfer allows the negotiation of parameters and ensures both ends are ready to communicate. **6.3 User ...
- 服务器端配置如Connection Termination With Do not Close和FIN关闭方式,以及延迟参数(Latency),都是为了模拟真实网络环境并评估设备的处理能力。 通过逐步调整并发数和观察测试结果,可以确定设备在边建边拆...
TCP Connection Establishment and Termination Section 2.7. TIME_WAIT State Section 2.8. SCTP Association Establishment and Termination Section 2.9. Port Numbers Section 2.10. TCP Port Numbers ...
**Connection Termination** TCP连接可以通过发送FIN包来正常终止。双方都需发送和接收FIN包以确保数据完整传输。 **Running The Programs** 为了运行这些程序,需要编译并链接相关的代码。在Windows环境下通常...
该层的主要功能是 segmentation、 Connection Establishment和 Connection Termination。 第五层:会话层(Session Layer),负责建立、维护和拆除应用程序之间的会话。该层的主要功能是对话控制、同步和恢复。 第...
43. **启动TCP或UDP连接 (Start up TCP or UDP connection)** - 命令: `AT+CIPSTART=,,;` - 参数: `<protocol>`为TCP或UDP,`<ip>`为目标IP地址,`<port>`为目标端口号。 - 功能: 启动TCP或UDP连接。 44. **通过...
##### 3.4 ATS3 Command Line Termination Character 该命令用于设置命令行终止字符: ``` ATS3=";" ``` ##### 3.5 ATS4 Response Formatting Character 该命令用于设置响应格式化字符: ``` ATS4="|" ``` ##### ...
**3.4 ATS3 Command Line Termination Character** 命令行终止字符。 **3.5 ATS4 Response Formatting Character** 响应格式化字符。 **3.6 ATS5 Command Line Editing Character (BACKSPACE)** 命令行编辑字符...
H.248协议使用TCP/IP协议栈进行传输,并且可以通过文本或二进制格式表示消息。协议定义了一系列消息类型,包括: - **Add**: 创建一个新的终端并将其添加到现有连接中。 - **Modify**: 修改现有连接的属性。 - **...
在TCP/IP协议中,ACK是确认数据包的接收状态的重要机制。 ADSL (Asymmetric Digital Subscriber Line) 非对称数字用户线 ADSL是一种宽带接入技术,允许用户通过现有的电话线接入互联网。ADSL技术可以提供高速的上行...
22. **TCP (Transmission Control Protocol)**:传输控制协议是一种面向连接的、可靠的传输协议,用于互联网上数据的可靠传输。 23. **TLD (Top Level Domain)**:顶级域名是互联网域名的最右边部分,如.com、.org...
Python参考手册,官方正式版参考手册,chm版。以下摘取部分内容:Navigation index modules | next | Python » 3.6.5 Documentation » Python Documentation contents What’s New in Python ...