gpt4 book ai didi

java - 主机查找的默认超时是多少?

转载 作者:太空宇宙 更新时间:2023-11-04 15:13:32 24 4
gpt4 key购买 nike

与此问题相关:How to set the timeout for socket when looking for host? ,我发现了解主机查找的默认超时很重要

如果超时很短,例如几分钟后,我认为什么也不做是安全的。如果它很长,例如几个小时,我必须为其设置超时。

查找主机时套接字的默认超时时间是多少?

最佳答案

JNDI Docs提供此信息:

The DNS provider submits UDP queries using the following exponential backoff algorithm. The provider submits a query to a DNS server and waits for a response to arrive within a timeout period (1 second by default). If it receives no response within the timeout period, it queries the next server, and so on. If the provider receives no response from any server, it doubles the timeout period and repeats the process of submitting the query to each server, up to a maximum number of retries (4 by default).

因此,这取决于您的配置中包含的 DNS 服务器数量,但默认初始值为 1 秒,如果所有服务器都失败,则每台服务器需要 31 秒; 1 + 2 + 4 + 8 + 16 = 31。(初始尝试 + 4 次重试)

关于java - 主机查找的默认超时是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21088089/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com