question

amazdeh avatar image
amazdeh asked

sometimes get could not resolve host name on Android in Unity

Sometimes I get

`java.net.UnknownHostException: Unable to resolve host "b7f9.playfabapi.com": No address associated with hostname`

The weird thing is, it only happens sometimes on very bad network but when it happens, it persists badly, No matter how many time I retyr, it instantly returns this without even retrying. Seems to be cached on the device or something.

Project uses Unity 2017.3 and latest playfab SDK built with API-Level 17 and running on Android 4.4 but have seen it in other phones and networks which since it was other team members, I don't have the exact details of the device atm. What should we do? I tried to switch from WWW to HttpWebRequest but that failed more during normal operations for some reason which is not known to me.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Yes, if your DNS isn't resolving the hostname, there's not much you can do apart from retry after a delay. The engine/SDK you're using is irrelevant in this case - it's simply a fundamental issue with your connection to the Internet (specifically, the DNS lookup - which is most commonly at the ISP level).

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

amazdeh avatar image amazdeh commented ·

Yes i am very well aware of that. The thing is that my DNS seem to resolve names right when i use the browser on the same connection. It happened to my workmates in the US when they were using one of those rented office rooms in SF. In those places the internet connection is usually bad and naturally WiFi's are very busy as well due to being many rooms rented by many people. I don't know what exactly in the stack is causing this, version of Java Http client libs which unity seem to use for WWW on Android or what other thing but since it doesn't happen to the browser, I assume something other than just the DNS is involved. Anyways i don't think you can do much about it probably in playfab.

Congrats on the Microsoft acquisition btw :)

0 Likes 0 ·
brendan avatar image brendan amazdeh commented ·

Thanks! We're pretty excited, since the acquisition means we'll be able to accelerate development of features. :)

It's very odd that the browser is working, in this case. That would seem to imply that you're unable to get the lookup info only while in the running project. Can you check that your manifest includes the Internet permission?

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.