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!
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With