4

I am currently experiencing a bug that causes iPads to randomly disconnect from the session, but only on one side.

At the beginning of the test

A ----> B

B ----> A

After a requests thats b send it some info

A ----> B

B ? A

I am currently testing this program with one dominate iPad (browser) and 15 other iPads (advertisers).

I am aware that sometimes calling sendData: to often or with to much data can cause disconnects, I am also aware of 8 default max on the MCSession. Which I why I create a new session after 6 peers have been found nearby.

I have discovered one thing about this bug. On the first trial of the test, there seems to be no disconnects however, after stopping the test, and beginning a second trial disconnects happen, usually 3-6 iPads. And I am properly ending the sessions, stopping browsing and advertising. However if I turn off/turn on all the iPads wifi and Bluetooth, the testing shows few (maybe 1) disconnect.

Strange problem which I seem unable to solve.

ZBurm
  • 121
  • 7
  • Are you talking about data transfer over bluetooth? I guess if too many devices are transmitting data, the network get too crowded and some devices get disconnected (lose connection)? – Daniel Mar 28 '14 at 19:07
  • @Daniel no, I am using the iOS 7 Multipeer connectivity API, not solely Bluetooth. – ZBurm Mar 29 '14 at 02:10
  • Have you see this: http://stackoverflow.com/questions/18935288/why-does-my-mcsession-peer-disconnect-randomly – 300baud Mar 29 '14 at 06:34
  • @300baud yes, i have already implemented those solutions without success – ZBurm Mar 29 '14 at 13:02
  • Have you tried using streams instead of sendData? – JuJoDi Apr 14 '14 at 12:30
  • I am encountering much the same as you. I only activate the browser on the "clients" and the advertiser on the "server". It operates fine for some time, then a random set of disconnects and like you, need to reboot the iPads. I enforce a single session between peers and currently have tested to 16 physical devices. Still trying to solve it... – 300baud Apr 27 '14 at 12:26

2 Answers2

4

I have been working on an open source library for multipeer connectivity and have seen many of the things you've seen.

So far, all I have are guesses, but I'll fill you in with what I've found.

  1. Are you sending invites both ways? If so, I've found it randomly disconnects after 10secs - 2 mins.
  2. Are you declining invite one way? I think this is also wrong. Instead, I think you should only send invites one way.
  3. Are you advertising or browsing while you send data? This is what I'm currently looking into, but I think it causes problems.

My suggestion to debug: Send an invitation from one device to the other and accept. Don't go both ways. Then, turn off all browsing and advertising. Then see where you get to.

Let me know how it goes. I'm trying to debug these same issues right now, so any info on what other people are seeing would be very helpful. Thanks.

plivesey
  • 2,337
  • 1
  • 16
  • 18
  • Hmmmm...I'm not convinced by the advertising or browsing being a problem. For me, I think the problem was sending invites two ways. – plivesey Apr 16 '14 at 02:00
  • Apple's WWDC session on the subject recommended sending the invites only one way. You can read the transcript at: http://asciiwwdc.com/2014/sessions/709?q=Multipeer – Bob Wakefield Apr 06 '19 at 16:05
  • 1
    I can't seem to browse to the session video, but the link I saved still seems to work: https://developer.apple.com/videos/play/wwdc2014/709/ – Bob Wakefield Apr 06 '19 at 16:12
2

Calling sendData: to often or attempting to sendData: to many peers causes disconnects.

ZBurm
  • 121
  • 7