Search code examples
wifibonjourservice-discoverymdnsdns-sd

Service discovery using dns-sd


I have a device which is configured in station mode. Device is connected to a smart phone over hotspot provided by smartphone. Device needs to search for a service published by an application on smartphone say _abc._tcp.

I am using the command dns-sd -B _abc._tcp but no output. Please guide me what I may be missing.

The application publishes the service. I verified it using Bonjour application on android.

Also please clarify

  1. Is it possible to discover the services while in station mode.
  2. While searching for services is it necessary to provide complete service name. If not how we can discover all the services published on the smart phone
  3. Can firewall settings on device affect for service discovery?
  4. How can we achieve the same in C++. Any libraries which can help in discovering.

Thanks is advance.


Solution

  • Is it possible to discover the services while in station mode.

    see station mode

    While searching for services is it necessary to provide complete service name.

    yes

    If not how we can discover all the services published on the smart phone

    Service discovery is meant to be used to discover a severice you're looking for like a printer or a webpage. One solution you might use is to find all services and query for each instance of the service. Each instance has a name and an ip which you can compare to the phone's ip. Well this is quite ugly I think.

    Can firewall settings on device affect for service discovery?

    Yes

    How can we achieve the same in C++. Any libraries which can help in discovering.

    There are libs in almost every language... search for c++ service discovery in your favourite search engine and you will find plenty (or another so-thread with links to one or more)