Multipeer Connectivity
Framework
報告⼈人:allenlinli 材料提供:李岡諭
2014.4.10
FireChat
請下載FireChat
⼤大家動⼿手做
• https://dl.dropboxusercontent.com/u/2857188/
MCDemo.zip
• 測試是否可以連⼋八個
Wireless mesh networking
• Peer-to-peer connections:
• infrastructure Wi-Fi networks
• peer-to-peer Wi-Fi
• Bluetooth personal area networks
Pros & Cons
• Pros
• Without an internet connection
• Location-based communication (nearby)
• Cons
• Sessions currently support up to 8 peers
• Data transfer is slow – especially on Bluetooth
• Can not cross networks in single connection
• Not support background mode
Sending & Receiving
Information
• Messages: Text or small serialised objects
(NSData)
• Streams: Audio, video, or real-time sensor
events
• Resources: Images, movies, or documents.
Build up Connection
Steps
• PeerID
• Session
• Advertise
• Browser
• Accept
_peerID = [[MCPeerID alloc]
initWithDisplayName:displayName];
_session = [[MCSession alloc] initWithPeer:_peerID];
_session.delegate = self;
_advertiser = [[MCAdvertiserAssistant alloc]
initWithServiceType:@"chat-files"
discoveryInfo:nil
session:_session];
[_advertiser start];
_browser = [[MCBrowserViewController alloc]
initWithServiceType:@"chat-files"
session:_session];
Data Transfer
[_appDelegate.mcManager.session sendData:dataToSend
toPeers:allPeers
withMode:MCSessionSendDataReliable
error:&error];
傳輸速度
• Bluetooth:
• Bluetooth (Bonjour over Bluetooth)
• Multipeer Connectivity 不是使⽤用 BLE/Bluetooth 4.0 advertisement。
• 猜測:使⽤用 Bluetooth Classic。
• WiFi
• Multipeer Connectivity 不是使⽤用 WiFi Direct。理論上可達 250
Mbps,實測⼤大約 35-50 Mbps。
• 猜測:與 AirDrop ⼀一樣,使⽤用 Adhoc WiFi。上限為 11 Mbps。實測
兩台 Mac 的 AirDrop 傳輸⼤大約是 18 Mbps (不同 Wifi 下是 4 Mbps)。
報告完畢,謝謝
感謝李岡諭
Resources
Tutorials
• http://www.appcoda.com/intro-multipeer-
connectivity-framework-ios-programming/
• http://code.tutsplus.com/tutorials/exploring-the-
multipeer-connectivity-framework-project-setup--
mobile-23071
• http://nshipster.com/multipeer-connectivity/

Multiple Connectivity Framework Keynote