Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create group using wifi p2p to connect multiple device

I want to create a connection where one device will be like server which will stream some data to connected and multiple device can connect to that device which receive data.

So i have done some kind of research i got to know that we can do this using network service discovery and WiFi peer to peer, So i have made the connection where i can connect one device and stream data also but i want to create a group to connect multiple device ,So any help from any one would be appreciated.

Thanks!

like image 775
Nikhil Sharma Avatar asked May 04 '17 04:05

Nikhil Sharma


1 Answers

WiFi-Direct or Wi-Fi Peer to Peer can do multiple device connection.

See this link to read more about P2P connections -https://developer.android.com/training/connect-devices-wirelessly/wifi-direct.html

WiFi-Direct automatically select which device will be the Group Owner or the server base on which device is the most compatible to be the Group Owner or the server. But you can manually select which will be the Group Owner by setting WifiP2pConfig groupOwnerIntent = 15(the highest value).

If two devices are connected, when you connect another device this device will connect to the group owner(or server).

For you to able to send streams to client devices you can use java Sockets. When peer to peer connection is established, the group owner will be the one to handle the server socket and client socket for the client devices.

If you have multiple devices and you want to send a message to a specific client device you'll send it to the server and the server will send it to the specific client. see this link - WiFi Direct (Android 4.0) with multiple (3+) devices

like image 187
Michael Angelo Reyes Avatar answered Sep 30 '22 11:09

Michael Angelo Reyes