Reputation: 1087
The device does have network connectivity (WiFi and 3G).
Calling gethostbyname() returns NULL with errno 111 (ECONNREFUSED).
The same call works fine on osx and windows.
What could be the problem?
Best,
Upvotes: 1
Views: 3590
Reputation: 11541
You should add permission to use Internet in your AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET"/>
Upvotes: 2
Reputation: 339975
ECONNREFUSED
suggests that the DNS resolver on your device may have tried failing over to TCP/IP (instead of UDP) because the answer was too long to fit in a normal UDP response packet.
If the configured DNS servers don't support inbound DNS requests over TCP you'd get that error.
Client apps can't normally get ECONNREFUSED
from a UDP socket because they're stateless.
Upvotes: 0
Reputation: 42953
The problem is most likely a not or wrong configured DNS server setting on your device. Be sure to check that. This is most probably a problem with your local WiFi network - probably there's no local DNS server.
Maybe you could also try disabling WiFi as DNS resolution should work automatically in your mobile network.
Upvotes: 0