5

There is a bug in Android in using a simple domain name ej: myservice.local etc

In PCs you can use nslookup and you get the full domain name such as company.domain.com Then this domain can be used to create a socket in the android app.

If I look in /etc/resolv.conf in my PC there is a list of domain names So if I manually add them in code and try them one by one and see which one works:

protected static final String [] DNSSS = new String[] {
    "bla.bla.net",
    "aaa.bbb.net",
    "comp.com",
    "ddd.cccc.net",
    "comp.net"
};

So my question is now: how can I do something that could work in a more general way? Of course I can add user settings where they could add their dns servers one by one but what are the other options? How could I solve this problem and somehow get this list of servers from local network but in android?

vallllll
  • 2,731
  • 6
  • 43
  • 77
  • 1
    As commented in the issues page, I think you need to get DHCP domain search option specified in http://www.networksorcery.com/enp/rfc/rfc3397.txt . – Reci Jun 21 '13 at 02:37
  • thks for the link but I don't see what you mean. How do you specify the domain search option? The ios app which is the client of the same service doesn't have this problem. – vallllll Jun 21 '13 at 09:08
  • 1
    First, I have not implemented DHCP client myself. But you can Google up and find some examples like http://www.netmite.com/android/mydroid/system/core/libnetutils/dhcpclient.c . Second, I mean you probably have to study the options in http://www.netmite.com/android/mydroid/system/core/libnetutils/dhcpmsg.h , and find out option 119, which contains the DNS search domains specified by the DHCP server. I think that is much more generic than hard coding. – Reci Jun 21 '13 at 20:31
  • Android, like iOS, prefers mDNS over traditional DNS. `*.local` is used by mDNS. One solution would be to implement mDNS on your network, but that doesn't solve compatibility with older networks. – Zenexer May 14 '15 at 23:36

0 Answers0