简体   繁体   English

通过wifi传输浮点值的最快方法

[英]Fastest way to transfer float value through wifi

In my iOS Application I would like to transfer a float value through the local network from iPhone A to iPhone B. Right now I'm using the iOS MultipeerConnectivity Framework, which is really easy to use and for sure a nice user experience as the user might now the interface from other apps. 在我的iOS应用程序中,我想通过本地网络将浮点值从iPhone A传输到iPhoneB。现在,我使用的是iOS MultipeerConnectivity Framework,它确实易于使用,并且可以为用户带来良好的用户体验现在可能来自其他应用程序的界面。 But the MultipeerConnectivity is too slow. 但是MultipeerConnectivity太慢。 I'm using (of course) the unreliable method. 我正在使用(当然)不可靠的方法。 I'm sending about 5 values per second. 我每秒发送大约5个值。 If a few fail to deliver I don't really care, but its very important that they deliver really fast (preferably lets say 1-100 ms). 如果有几个传递失败,我一点也不在乎,但是非常重要的一点是它们传递得非常快(最好是说1到100毫秒)。 Another problem I see in MultipeerConnectivity, I can't disable the ability to use bluetooth instead of wifi, wich is even slower (or maybe I just didn't see the option to disable bluetooth). 我在MultipeerConnectivity中看到的另一个问题是,我无法禁用使用蓝牙而不是wifi的功能,甚至更慢(或者也许我只是没有看到禁用蓝牙的选项)。 I do know there are always unexpected delays (maybe the network is busy with other devices, or the wifi signal is bad,...), but when I was testing I used an Airport Extreme, almost 100% signal strength on both iPhones and there was no network activity. 我确实知道总是会有意想不到的延迟(也许网络正忙于其他设备,或者wifi信号不好,...),但是当我进行测试时,我使用的是Airport Extreme,iPhone和iPhone上的信号强度几乎都是100%没有网络活动。

So my question is basically: what is the fastest way to transfer small (very small, two decimal places) values through the network? 所以我的问题基本上是:通过网络传输小(非常小,两个小数位)值的最快方法是什么? Should I use Bonjour, I have no idea)? 我应该使用Bonjour,我不知道)吗?

Bonjour is a protocol for network discovery. Bonjour是用于网络发现的协议。 You can connect local peer devices with and without Bonjour. 您可以在有或没有Bonjour的情况下连接本地对等设备。 But Bonjour would make life simpler. 但是Bonjour会让生活变得更简单。 It has no effect on the performance that you have decribed. 它对您描述的性能没有影响。

I have not used the new MultipeerConnectivity Framework so cann't attest to happen in your case. 我没有使用新的MultipeerConnectivity框架,因此无法证明在您的情况下会发生。 But there is this third party CocoaAsyncSocket network library that is quite simple to use. 但是,该第三方CocoaAsyncSocket网络库的使用非常简单。 Examples are included in the package provided. 提供的包中包含示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM