Unknown host exception returned when attempting to connect to the server on the HTC Rezound and only on 4g

463 Views Asked by At

I have a very specific Android HTC Rezound issue and I'm hoping someone may have a solution.

While using the HTC Rezound AND connected to a 4g network I recieve an unknown host exception error when attempting to connect to our servers using HttpURLConnection. The strange thing about this issue is that if the phone is on Wi-Fi or 3g the connections to the server work perfectly. Only 4g has the issue. I beleive the issue stems from the servers TTL (Time to Live), which is set to 0 seconds. Unfortunetly, changing the TTL is not an option and a work around is needed.

As a test I hard coded the IP address of the host name and attempted to connect using that and it worked fine. Now, hard coding the IP address is not a real solution as the servers are using a DNS level round robin load balancer. I tried to programmatically retreive the IP address using InitAddress:

InetAddress inet = InetAddress.getByName(url.getHost());
String ipAddress = inet.getHostAddress();

Unfurtunately, this workaround also returns an Unknown host exception as well.

I also attempted to change the Java's internal DNS Cache by using:

     System.setProperty("networkaddress.cache.ttl" , "100"); 

But this too did not work.

Any other suggestions or solutions would be greatly appreciated!

Thank you.

1

There are 1 best solutions below

0
On

I had issue with 3g because ISP for phone set proxy by default (everything else and with another isp worked ok thou). Try to check connection settings on device and remove if any is set. I hope it helps.