4

I have 3 devices (I call them device A,B, and C)and I want to connect them in a group. I can do one-to-one connection now and it works fine.

However, while I am trying to connect the third device, the connection between the other two devices fails. For example, first I connect A and B. After negotiation, A becomes the group owner. Now everything alright. Then I try to connect A and C. The accept message prompt successfully on C, but "most of the time" the connection fail, and A and B also disconnect.

Why I say "most of the time" because it really works, although the probability is very low (< 10%).

Anyone happen to know why this happen?

Tim Lin
  • 41
  • 1
  • 3

1 Answers1

4

Once A is a group owner, it can't initiate any more connections. The connection has to be initiated by the device outside the group.

When you try to connect using wifi-direct, you're setting up a wifi network with the group owner as the access point. If you try to connect again, you're going to be trying to set up a new wifi network, which will force you to leave the old one.

Short version: Each device can only connect once.

optimality
  • 76
  • 2
  • But I tried using the device outside the group to connect the group owner and the connection between A and B still broke up – Tim Lin Sep 27 '13 at 05:54
  • @TimLin, when starting connection with `WiFiP2pManager.connect`, you pass `WifiP2pConfig` to it. One of the fields is `groupOwnerIntent`. You possibly should make sure you set it to 15 for current group owner and to 0 for new connecting client. I'm not sure how Android chooses group owner without this field, but if both devices are somehow treated as both equally legitimate to become/remain group owner, they could break connection. – Stan Oct 25 '13 at 12:29