Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi-Peer Connectivity in iOS 7 transfers incredibly slow

I am trying to transfer 2 megabytes worth of data using the new multi-peer connectivity framework in iOS 7. I am finding that sending and receiving 2 megabytes of data takes at least 5 minutes. This seems very odd. This is between an iPhone 5S and an iPad 3 in the same room. Problem happens regardless of whether WiFi or Bluetooth are enabled or disabled and whether reliable is on/off.

// self.session is an open MCSession, packet is the 2 MB of data, reliable is YES or NO, both are slow
[self.session sendData:packet toPeers:peers withMode:MCSessionSendDataReliable error:&error];
like image 910
jjxtra Avatar asked Oct 25 '13 03:10

jjxtra


1 Answers

I'm pretty sure this is because the iPad 3 is the bottleneck. Transfer from iPhone 5S to iPad Simulator on my MacBook Air for a 10 MB file was about 1 second. My theory is that only AirDrop enabled devices will get fast transfer speeds - http://en.wikipedia.org/wiki/AirDrop.

EDIT My assumption was wrong, transfer between two iPhone 5s is just as slow :(

EDIT Switched to streams API and it's much better

EDIT Tweaking wifi channel settings on my router has helped performance, but it still seems slower than it should be. 10 MB transfer now takes 30-60 seconds instead of 5 minutes.

EDIT I solved the problem by converting the images to JPEG2000 which is vastly smaller than PNG, even though the transfer is only like 100K a second it now finishes in a reasonable 5-10 seconds. See this stackoverflow answer: How do I convert UIImage to J2K (JPEG2000) in iOS?

EDIT Disabling encryption has also helped with transfer speed

like image 127
jjxtra Avatar answered Nov 30 '22 23:11

jjxtra