开发者

Android HttpURLConnection randomly throws java.net.UnknownHostException: Host is unresolved

I have a mostly complete android application that is exhibiting some odd behavior when contacting my servers. First thing to know is the environment. There are several devices on the network that provide constant udp media streams. They do not appear to be overloading the network in any way. The phone connects to the wifi network and does some data monitoring and reports information back to two different servers, both of which are under my control. The two servers are on completely different domains. The router is a brand new linksys wireless N router with stock firmware.

So the problem is that after the android does the necessary evaluation of the media streams (which requires connection to the network, though not to the internet) it has recently started to have severe problems contacting the servers. It usually connects to one but t开发者_StackOverflow中文版hrows 'java.net.UnknownHostException: Host is unresolved' for the other. This continues for a random amount of time (generally several minutes and through several application restarts). After some time of this repeating error) it will start working for both servers, or flip which ones are working, or do several other random things. To make it more confusing, several phones in the same room doing the same operation all usually see a different combination of the servers (all, one or the other, or none) with no obvious Rhyme or reason.

Up until recently this has not been a problem, but through review of the code shows that the part that actually contacts the servers hasn't changed in form, so in theory this means it should still work fine. My only clues are that another network with a similar setup, just less media streaming devices and a simpler, less used internet connection, has less problems. This fact is making me start to think that putting DDWRT on the router might make it behave better if the udp traffic is throwing it for a loop. Another idea for these bizarre errors is that somehow changing to the wifi network messes up the DNS tables and they aren't refreshed or something silly like that. Though this wouldn't really make sense because I am testing on several Devices with differing Os versions, plus things were working well a while ago.

Anyways, I really don't expect someone to know the answer to this since it is such a random issue, but I thought it couldn't hurt to post it, and at least get the opportunity to write my thoughts down for better review. But if anyone has any ideas how to handle these random network errors or can suggest other places to look for problems, I would be very thankful.

Thanks ahead of time, Jessy Diamond Exum

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜