如果接收进程停止或挂起,TCP 连接会发生什么? [英] What happens in a TCP connection if the receiving process stops or suspends?

查看:31
本文介绍了如果接收进程停止或挂起,TCP 连接会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,在 TCP Tahoe 连接中,如果发生大文件传输.突然接收进程或主机被关闭或暂停,我知道我们将有一个超时,此时窗口大小将被重置等.据我所知,我们将重新发送未被确认的数据包,然后再试一次,可能再次?

For example, in a TCP Tahoe connection, if there is a large file transfer happening. Suddenly the receiving process or host is shutdown or suspended, I know that we will have a timeout, at which point the window size will be reset, etc. As I understand it we will resend the packet that was unacknowledged, and then try again, and possibly again?

我想知道,在像这样的超时之后,在假设接收器不再存在并且数据将停止发送之前,数据将重新发送多少次.如果进程从挂起状态恢复,它还能继续接收数据吗?

I am wondering though, after a timeout such as this how many times data will get resent before it is assumed the receiver is no longer there and data will stop being sent. If the process is resumed from a suspended state will it be able to keep receiving data?

我知道数据在三重重复确认或超时后重新传输.但是,如果多次重传失败,或者接收进程突然停止接收会发生什么,我找不到太多可以阅读的内容.

I know that data is re-transmitted after a triple duplicate ack or a timeout. However, I cannot find much to read on what happens if there is multiple re-transmissions fail, or if a receiving process is suddenly stops receiving.

推荐答案

如果接收进程退出或被杀死,其末端的套接字将被关闭.当发送方继续发送数据包时,他们应该提示RST数据包,这将立即导致错误(ECONNRESET).

If the receiving process exits or is killed, the socket at its end will be shut down. When the sender continues sending packets, they should prompt RST packets, which will cause an error (ECONNRESET) immediately.

如果接收主机干净利落地关闭,它应该杀死所有进程,这将导致上述情况发生.

If the receiving host is shut down cleanly, it should kill all processes, which will cause the above to occur.

如果接收主机和进程是存活的,但是进程被挂起(例如Ctl-z),在TCP层面不会检测到问题.窗口最终会填满,但接收系统将继续确认零窗口探测.要检测这种情况,您需要一个应用层保活机制.

If the receiving host and process are alive, but the process is suspended (e.g. Ctl-z), no problem will be detected at the TCP level. The window will eventually fill up, but the receiving system will continue to acknowledge the zero-window probes. To detect this case, you need an application-layer keepalive mechanism.

如果接收主机崩溃、断电或网络连接失败,那么重传超时就会变得相关.重传的次数和频率取决于实现方式,也可以由系统配置参数控制.我不知道什么是典型参数.

If the receiving host crashes, loses power, or its network connection fails, that is when retransmission timeouts become relevant. The number and frequency of retransmissions is implementation dependent, and may also be controlled by system configuration parameters. I don't know offhand what are typical parameters.

如果接收系统在超时发生前重启,它会用一个RST包响应下一次重传,这将导致ECONNRESET错误.

If the receiving system reboots before the timeout occurs, it will resond to the next retransmission with a RST packet, which will cause the ECONNRESET error.

这篇关于如果接收进程停止或挂起,TCP 连接会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆