Native DNS hangups

607 views
Skip to first unread message

ColorTheorist

unread,
Feb 21, 2013, 3:05:44 PM2/21/13
to andro...@googlegroups.com
  The native code that I am currently using within an Android Library project is responsible of using ZeroConf/Bonjour for discovery of endpoints in the local network.  The C/C++ code works well on iOS and personal computers, however I am having hangups on getting it to work on Android.  The discovery and communication from these endpoints will then be used within my application for data exchange.

  I am handling the enabling of multicast through the permissions as would be expected, and have even gone as far as to enable nearly all the permissions just be sure that I wasn't leaving something out when I was testing the code.

  In addition to permissions, I have created a MulticastLock as suggested by several threads and making sure that the reference counted of the lock is also set to true before delving into the native code.

What I do get for output is typically something along the lines of the following:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
02-21 14:42:05.773: I/JNI_NDK_DEBUGGING(16763): JNI_OnLoad called
02-21 14:42:05.773: I/android_my_log(16763): mDNSResponder (Engineering Build) (Feb 18 2013 11:32:58) starting
02-21 14:42:05.773: I/android_my_log(16763): ERROR: Unable to set maximum file descriptor limit: 1 (Operation not permitted)
02-21 14:42:05.773: I/android_my_log(16763): Unable to parse DNS server list. Unicast DNS-SD unavailable
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All of which I have followed to the source code and spent hours trying to figure out why it might be failing (uds_daemon.c  PosixDaemon.c & mDNS.c throw errors).  While I will be doing further research into this and these classes, I was hoping to potentially here back that something may or may not work or I might be missing something glaringly that someone could point out  Attempts to search for keywords and issues with these printouts have failed thus far.  So I am reaching out to the community for suggestions and comments on how to progress further.

Can I not do DNS discovery using ZeroConf libs without doing some sort of Java JDNS or something of that nature? 
Perhaps access and need for file access to a network configuration on the device is not available to me?
Or any other possible oversight that I just need to correct for in order to discover properly would be great feedback.

ColorTheorist

unread,
Feb 26, 2013, 3:37:42 PM2/26/13
to andro...@googlegroups.com
The issue seems to resolve around the DNS Server List reference from '/etc/resolv.conf' within the 'static void Reconfigure(mDNS *m)' method inside of the 'PosixDaemon.c' class. This is where it will print out the "Unable to parse DNS server list. Unicast DNS-SD unavailable" statement.  There are several questions that answer the only way to modify and gain access to this file would be to have root user access.  But I would assume that in order to discover devices over the Zeroconf protocol that I shouldn't need to have root access.

Perhaps this isn't what is limiting the functionality of the application that I am working on and is really just a warning.  But I have to assume that some of you have run across a situation such as this while using multi-cast communications on the native side of Android.  Or at least I am hoping, as I cannot seem to resolve this issue on my own at the moment.

ColorTheorist

unread,
Feb 27, 2013, 11:19:48 AM2/27/13
to andro...@googlegroups.com
While I had been hoping that there was a resolution in order to take advantage of resolving the DNS hostnames over the wifi within the native code, I have come to another conclusion.  It does not seem as though this is currently a possibility.  And the following thread that I had come across (which I have read in full ... took a while) describes this in detail at different stages over the past two years.


The way that I am attempting to get information using the Zeroconf/Bonjour discovery on the native side then will not be possible without a root option or similar feature change in the source code that would not be acceptable for a published application.  However, I did want to bring an answer to my own question and what I had come across to the community as well in case someone else comes across these issues in the future and attempts to resolve DNS names within the intranet for their own use in an application.
The next release beyond 4.2 Jellybean is decided to bring these features to us however, so perhaps a release of an application at that stage and OS will be necessary in the coming months.  At least updates occur pretty frequently in the Google Android world and I am quite happy of that.
Reply all
Reply to author
Forward
0 new messages