1

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.

user881259
  • 163
  • 1
  • 3
  • 10

3 Answers3

0

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

Yaniv
  • 1
0

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).

Jon Shemitz
  • 1,235
  • 13
  • 29
0

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

it is answer

Community
  • 1
  • 1
lingyfh
  • 1,363
  • 18
  • 23