Android, NSD/DNS-SD: NsdManager unreliable discovery and IP resolution

前端 未结 2 704
别那么骄傲
别那么骄傲 2021-02-05 11:20

In the course of the last weeks, Android\'s NSD implementation is making me go mad:

From a user\'s point of view, the following problems arise:

  • Devices

相关标签:
2条回答
  • 2021-02-05 11:25

    It's probably no longer relevant, but I discovered one of the possible causes of my problem: from my experience it seems NSD behaves extremely unreliable if you do further processing within the thread of the NsdManager callback methods. Even if there is just a few lines of code, the weirdest results regarding discovery occur. So one must offload any work from the callback methods to another thread, and avoid to block the NsdManager at all costs, even for a millisecond.

    0 讨论(0)
  • 2021-02-05 11:30

    Still no difference with Android NSD. I had been using Marshmallow version of Android and NSD actually is still unreliable. I replaced the NSD with RxDNSSD ( https://github.com/andriydruk/RxDNSSD ). Few liner code works perfect till now.

    I tested NSD & RXDNSSD, NSD was able to discover service but not able to resolve IP address while RXDNSSD was working all the time.

    Hope it will help for other users.

    0 讨论(0)
提交回复
热议问题