Can someone steer me to documentation on how the Reliable option works for sendData using Apple's Multipeer Framework for iOS? From what I can learn, it guarantees delivery in the right order, but what happens when the connection between peers is unreliable? When the two devices reconnect, will they resume transmission? If the receiver goes away permanently, what's the mechanism to tell the sender's app that the message failed in order to start recovery? At what point does the sender's outbound queue get cleared? Thanks!
Asked
Active
Viewed 226 times
1
-
Hi Dave. Welcome to posting on Stack Overflow. I think you should *attempt* to answer these questions in your post and refer to the supporting documentation with regards to each point. The reason the question is getting down voted is because the community tends to take a dim view of overly broad questions that haven't demonstrated a real research effort. Here are some guidelines to help you: [How to Ask](https://stackoverflow.com/help/how-to-ask). Cheers! – Elletlar Jul 23 '18 at 00:47
-
As I explained in my original post, I can't find anything in the documentation that explains how the function works vis-a-vis disconnections. The question is very specific: it asks if anyone knows of any documentation that does explain it. Further, I explain what Reliable is suppose to do (per the documentation) to demonstrate I have an understanding of its purpose. Lastly, I give examples of the level of detail I am looking for. If someone in the community knows somewhere that this is explained (or could explain it), I would appreciate it. – Dave Jul 23 '18 at 03:12
-
Okay, but I still do not think this is a good Stack Overflow question as currently presented. It is asking a series of questions without any links to content that might aid in the discussions of the answers. We tend to focus on specific answers for specific questions usually involving code, commands, logs, sections of documentation, etc. What we try to avoid is general discussions about how things work since there are plenty of forums on the internet for those types of questions and they are not that useful to busy IT people that need immediate specifics. – Elletlar Jul 23 '18 at 11:02
-
The documentation is https://developer.apple.com/documentation/multipeerconnectivity/mcsession/1406997-senddata and sepcifically https://developer.apple.com/documentation/multipeerconnectivity/mcsessionsenddatamode?language=objc where it states: MCSessionSendDataReliable: The framework should guarantee delivery of each message, enqueueing and retransmitting data as needed, and ensuring in-order delivery. What it doesn't say is whether the 'SHOULD' works when the peer-to-peer connection is broken and whether/how it signals the caller if it fails to "guarantee delivery". Anyone know? – Dave Jul 23 '18 at 12:02
1 Answers
0
Lacking any info, I implemented a numbered packet scheme whereby the sender sends to the receiver a sequential 'packet' number and a pre-assigned sender ID embedded in the data that remains constant thru crashes, reboots, etc. All transmissions are queued at the sender in the event resending is required. When the receiver gets the message, it pulls the 'packet' number out and performs one of three actions:
- if it was the expected next packet (base on tracking the packets already received from the sender), it processes it and tells the sender to remove it from its transmission queue.
- if a packet number was skipped, it ignores it and asks the sender to resend everything in the queue beginning with that packet.
- if the packet number was already received, it discards it as a duplicate although it signals the sender that it can remove it from its transmission queue.
In normal operation, this scheme relies on the "reliable" setting to deliver the messages in sequence. However, the second and third options are critical in the event of a disconnect/reconnect since it prevents duplicate and lost messages.

Dave
- 71
- 5