简体   繁体   English

服务器的Tcp连接关闭启动是否可行?

[英]Tcp connection closing initiation by server is fevorable?

According to tcp protocol when ever tcp connection termination is going on, tcp socket of initiator go to following states FIN-WAIT-1, FIN-WAIT-2,TIME-WAIT before connection is completly closed and the tcp socket of other end go to following states CLOSE-WAIT, LAST-ACK, CLOSED before connection is completly closed. 根据tcp协议进行tcp连接终止时,启动器的tcp套接字在连接完全关闭之前进入以下状态FIN-WAIT-1,FIN-WAIT-2,TIME-WAIT,另一端的tcp套接字转到以下状态CLOSE-WAIT,LAST-ACK,CLOSED在连接完全关闭之前。 In our application server is initiating connection termination which leading to server side sockets are waiting in FIN_WAIT2 state infinitely, due to this connections made by clients are dropped by server because of unavailability of ports. 在我们的应用程序服务器中启动连接终止,导致服务器端套接字无限期地在FIN_WAIT2状态中等待,因为客户端由于端口不可用而被服务器丢弃。 Is connection termination initiated by clients is favourable or not? 客户发起的连接终止是否有利?

Initiating termination from the client can be favorable because it prevents the server from going to TIME_WAIT. 从客户端启动终止可能是有利的,因为它阻止服务器进入TIME_WAIT。 Your problem is different. 你的问题不同了。

A socket in FIN_WAIT2 is "half open": the client side can still send data and you can read it, but you can't send anything back. FIN_WAIT2中的套接字是“半开”:客户端仍然可以发送数据,您可以读取它,但不能发回任何内容。 The socket will stay in this state until the client closes its socket, or the server resets the connection. 套接字将保持此状态,直到客户端关闭其套接字,或者服务器重置连接。

So it sounds like your clients are simply not closing their sides of the connections. 所以听起来你的客户根本就没有关闭他们的连接方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM