check disabling of dns caching in Android

走远了吗. 提交于 2020-01-01 07:28:09

问题


My colleague have disabled dns caching in Android application. But we have to check whether we really disabled caching. Do you have any ideas how to check it?

We used the next commands to disable it:

System.setProperty("networkaddress.cache.ttl", "0");
Security.setProperty("networkaddress.cache.ttl", "0");

ps: this disabling is needed for automation tests.


回答1:


Its working. I've tested it connecting to a servers url with a dynamic IP. Before it took 2 hours until it could resolve the changed IP. after adding your code it resolved the new IP imm




回答2:


My guess is that Yaniv is seeing what Yaniv wants to see: If you grep the Android source code for networkaddress you can see that it only appears in some Apache Harmony test code. That is, it doesn't seem like Android uses the networkaddress.cache.ttl setting(s).




回答3:


Android not support that way, change dns cache when android 4.0, can't change dns ttl

it is answer



来源:https://stackoverflow.com/questions/9875379/check-disabling-of-dns-caching-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!