gpt4 book ai didi

java - InetAddress.getByName 间歇性失败并出现系统错误

转载 作者:搜寻专家 更新时间:2023-11-01 03:51:56 30 4
gpt4 key购买 nike

我有一些使用 InetAddress.getByName 的代码。我间歇性地得到一个 UnknownHostException:

java.net.UnknownHostException: google.com: System error
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
at java.net.InetAddress.getAllByName0(InetAddress.java:1246)
at java.net.InetAddress.getAllByName(InetAddress.java:1162)
at java.net.InetAddress.getAllByName(InetAddress.java:1098)
at java.net.InetAddress.getByName(InetAddress.java:1048)

执行 nslookup google.com 有效,故障本身只是偶尔发生。可能是什么原因造成的?

最佳答案

试着看看official java documentation

Throws: UnknownHostException - if no IP address for the host could be found, or if a scope_id was specified for a global IPv6 address.

关于java - InetAddress.getByName 间歇性失败并出现系统错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24110639/

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