Problem
Calling HttpDnsService.getIpsByHostAsync after a network transition sometimes returns an empty IP address.
Cause
A network transition can cause a change in the carrier, which invalidates previously resolved IP addresses. When the SDK receives a network transition broadcast, it purges the resolved IP addresses from memory.
Solution
You can set HttpDnsService.setPreResolveAfterNetworkChanged(true) to prevent the SDK from returning an empty IP address. When this parameter is set to true, the SDK immediately resolves the domain name again after a network transition.
该文章对您有帮助吗?