Service discovery using dns-sd

二次信任 提交于 2019-12-24 08:55:14

问题


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.


回答1:


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)




回答2:


Codewing has already provided answers.

To add to above answers.

Can firewall settings on device affect for service discovery?

Yes. Also service discovery can happen on multiple interfaces (wlan0, eth0...). These interfaces also affect service discovery. To check on this dns configuration file can be checked. In my case interface wlan was disabled in configuration file so I was unable to discover services.



来源:https://stackoverflow.com/questions/40662608/service-discovery-using-dns-sd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!