请教Windows TCP中又没关于keepalive设置的参数?

问题

2020年12月8日星期二 上午8:51

尊敬的微软工程师,

请教Windows TCP中又没关于keepalive设置的参数?

我查到这份链接:

https://support.esri.com/en/technical-article/000006285

  • On Microsoft Windows set KeepAliveTime to 300000.

    Code:
    \HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\TCPIP\Parameters
    

    If the KeepAlivetime parameter does not already exist in the above location, create it. The time specified is in milliseconds.
    See link to a Microsoft TechNet article in the Related Information section below.

请教一下这份链接说的对吗?是在

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\TCPIP\Parameters下面设置 KeepAliveTime 的;为30000吗?

谷青松

全部回复 (10)

2020年12月9日星期三 上午1:57 ✅已答复

你好,

对的,在Windows中是在您说的位置设置KeepAliveTime的;的: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters\KeepAliveTime

详细请参考以下官方文档:

/en-us/archive/blogs/nettracer/things-that-you-may-want-to-know-about-tcp-keepalives

(如果上述回复对您有帮助的话,请帮忙标记为答案。这样一方面可以将有用的信息注释出来,一方面可以提高看到您帖子的朋友回复您帖子的积极性。感谢您!)

Best Regards,

Anne

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


2020年12月9日星期三 上午2:14

修改这个有没有命令?

默认我看了计算机\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters下面KeepAliveTime这个;是没有的,是不是意味这个;的默认就是2小时?,烦请告知!

另外我看到

Important note: If OS is Windows Vista/2008, the number of TCP Keepalive attempts are hardcoded to 10 and could not be adjusted via the registry.

这个意思就是Vista/2008以后版本都不能进行注册表更改对吗?

谷青松


2020年12月9日星期三 上午2:22

看了一下还是没怎么理解,你能解释一下吗?

谷青松


2020年12月9日星期三 上午2:55

你好,

是的,默认是没有这个参数的,默认情况下这个;是2小时(注册表中没有显示出来,默认情况下这个;没有的),如果我想自己修改的话,就需要通过添加这个;来设置时间。

以下是通过命令设置这个;的方法:

打开CMD,输入reg add "HKLM\System\CurrentControlSet\Services\Tcpip\Parameters" /v KeepAliveTime /t REG_DWORD /d 300000

Best Regards,

Anne

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


2020年12月9日星期三 上午3:02

我看到这句话

Important note: If OS is Windows Vista/2008, the number of TCP Keepalive attempts are hardcoded to 10 and could not be adjusted via the registry.

是否意味着这个修改只在Windows2003以前版本有效,hardcoded to 10 这个是什么意思?能告诉我吗

谷青松


2020年12月9日星期三 上午3:16

你好,

那段话的意思是:

如果操作系统是Windows Vista / 2008,则TCP Keepalive“尝试次数”将被硬编码为10,并且无法通过注册表进行调整,主要指的是次数。

而KeepAliveTime控制TCP尝试通过发送一个keep-alive来验证空闲连接是否完好的频率, 主要指的中间的等待时间。

两者说的不是一个。

Best Regards,

Anne

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


2020年12月9日星期三 上午3:48

你好,

那段话的意思是:

如果操作系统是Windows Vista / 2008,则TCP Keepalive“尝试次数”将被硬编码为10,并且无法通过注册表进行调整,主要指的是次数。

而KeepAliveTime控制TCP尝试通过发送一个keep-alive来验证空闲连接是否完好的频率, 主要指的中间的等待时间。

两者说的不是一个。

Best Regards,

Anne

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

你说的KeepAlive指的是KeepAliveInterval 吗 ?

谷青松


2020年12月9日星期三 上午3:51

你好,

是的,默认是没有这个参数的,默认情况下这个;是2小时(注册表中没有显示出来,默认情况下这个;没有的),如果我想自己修改的话,就需要通过添加这个;来设置时间。

以下是通过命令设置这个;的方法:

打开CMD,输入reg add "HKLM\System\CurrentControlSet\Services\Tcpip\Parameters" /v KeepAliveTime /t REG_DWORD /d 300000

Best Regards,

Anne

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

设置300000代表多少时间,是300000毫秒吗?,能不能告诉一下

谷青松


2020年12月10日星期四 上午2:45

你好,

  1. KeepAliveTime中设置的;的单位是毫秒,所以,你的理解是对的,300,000是毫秒,也就是5分钟。

  2. 您上面提到的那个硬编码为10这一项注意点针对的是TcpMaxDataRetransmissions这个项说的,指的是TCP在中止连接之前重传单个数据段(不是连接请求段)的次数。

Best Regards,

Anne

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


2020年12月16日星期三 上午6:30

你好,

我注意到您取消标记为答案了,您是还有其他问题或疑问吗?有的话,欢迎反馈。

Best Regards,

Anne

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.