Available service types in WifiP2pDnsSdServiceInfo

2019-02-15 06:16发布

I'm programming an android application that uses Wifi Direct. I'm trying to start my service and I'm calling WifiP2pDnsSdServiceInfo.newInstance. However, I have been searching for the different service types that I could use, and so far I have only found "_presence._tcp".

I understand that I should somehow find a service type that "makes sense" with what my application tries to accomplish. Can I just "invent" it? Is there any available list of protocols?

Thanks a lot!

1条回答
家丑人穷心不美
2楼-- · 2019-02-15 07:01

Android documentation provides some info to start with in the guide Using Network Service Discovery. According it the service type specifies which protocol and transport layer the application uses. The syntax is _<protocol>._<transportlayer>. So you should only use existing transports in the second part. Most commonly used are tcp and udp, of course.

As for the first part, there is a bunch of application level protocols. For example, presence is a messaging protocol from xmpp.org, and ipp is a printer service. You can find more or less complete list of the registered protocols at the dns-sd.org site. Also you may have a look at the service names registry at iana.org.

As the DNS-based Service Discovery is a part of Zero-configuration networking which has numerous implementations, additional lists of protocols can be found on specific vendors sites. For example, here is the list of Apple's Bonjour service types.

I don't think there exists a single exhaustive list of protocols used worldwide. Nevertheless, I suppose you could invent your own name with a reasonably distiguishable underlying structure (acronyms and/or semantics) - just search through the Internet and make sure your name does not appear in relation to Zeroconf and DNS-SD.

查看更多
登录 后发表回答