也是Android NSD(网络服务发现)与iOS的Bonjour服务兼容?也是、网络服务、发现、Android

2023-09-03 22:29:05 作者:坐在坟里连wifi

我将创建一个无服务器的本地网络应用程序的iOS和Android。该应用程序在iOS和Android设备应该找出并互相交谈。

我知道,有平台的内置服务(这是卓悦在iOS和NSD在Android的自V4.1),此外,一个开源的 jmdns 包可以使用出框为好。

我不知道如何选择,如何为他们的兼容性。

我的问题是:

的是Android NSD(网络服务发现)在iOS中使用Bonjour兼容? 我应该在我的应用程序使用的服务发现什么。 在我需要使用第三方lib如果我还开发了PC版的应用程序? 解决方案

我公司开发类似的项目。让我来回答你的问题:

是。 官方样片code 应该能够让你快速上手。实现服务发现的功能是很容易的。只有两个步骤:建立一个监听发现与有关回调,并作出单一的异步API调用来discoverServices()。 如果您使用的第三方库,优势:它可以使下面的Andr​​oid 4.1应用程序工作; 缺点:发展服务发现会更复杂的功能。由于需要写入后台服务收听到网络上的广播。

I will create a server-less local networking App for iOS and Android. the App in both iOS and Android devices should find out and talk to each other.

I know that there are platform built-in services (which are Bonjour in iOS and NSD in Android since v4.1), in addition, a open source jmdns package can be used out of the box as well.

更新 iOS14.5.1 后性能下降 测试来了

I don't know how to choose and how is their compatibility.

My questions are:

Is Android NSD (network service discovery) compatible with Bonjour in iOS? What should I use for service discovery in my App. Do I need to use third-party lib if i also develop PC version for the App?

解决方案

I developed similar project. Let me answer your questions:

Yes. The official sample code should be able to make your quick start. Implement the function of service discovery is very easy. Only two steps: setting up a discovery listener with the relevant callbacks, and making a single asynchronous API call to discoverServices(). If you use the third-party library, Advantage: It can make your application works below Android 4.1;Disadvantage: Developing the function of service discovery would more complex. Because of you need write a background service to listen to broadcasts on the network.

 
精彩推荐