Hi, I'm facing a network problem on Android 10 that happens only randomly:
Code:
java.net.SocketTimeoutException: failed to connect to www.mydomain.com/81.NN.NN.NN (port 443) from /10.9.1.178 (port 49640) after 10000ms
In my Android App, in the method that performs the https connection I have this line of code:
Java:
java.security.Security.setProperty("networkaddress.cache.ttl" , "0");
With my previous phone with Android 6 the same code works without problems.
I've done lots efforts to try to discover the reason of that error.
Recently I tried to run my code after disabled NetGuard: sometimes my app immediately works, sometimes it works after some minutes, sometimes after reinstalling my app (always from Android Studio), sometimes while NetGuard is active normally.
Today while the problem was happening I tried to leave NetGuard active, I activated the airplane mode, then disabled airplane mode and my app successes on connecting without the need to reopen/reinstall it and without closing NetGuard.
Maybe the problem is related to the caching DNS TTL? Does my line of code is ignored or wrong?
How can I set properly NetGuard?
I'm using NetGuard to block all traffic for applications that I cannot uninstall, so I need it, I'll use it since years and it worked always fine!
Here you can find lots other info:
https://stackoverflow.com/questions/66303303/http-request-fails-even-if-the-connection-is-active
Thanks for your work and for your support!