简体   繁体   中英

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. But the MultipeerConnectivity is too slow. I'm using (of course) the unreliable method. I'm sending about 5 values per second. 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). 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). 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.

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 is a protocol for network discovery. You can connect local peer devices with and without Bonjour. But Bonjour would make life simpler. 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. But there is this third party CocoaAsyncSocket network library that is quite simple to use. Examples are included in the package provided.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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