Adapting Bluetooth Bluetooth Chat for Multiple Devices

I am making a college project on Bluetooth for Android, and I am trying to figure out how to manage the communication between several connected devices. In the end, I'm going to develop a multi-player Bluetooth game.

I have currently adapted the Android app for Android BluetoothChat to connect my three Nexxus One phones. 1 connects to 2, who connects to 3 1 successfully sends its messages to 2. 3 successfully sends its messages to 2. 2 can successfully send its messages 1 and 3, since it shares ConnectedThread with both. But I can’t understand how to handle messages from 1 to 3.

Does anyone have examples of communication between multiple devices or did they do it themselves? Thanks

+5
source share
2 answers

One way is to annotate messages with the sender and receiver, so that when 2 receives the message, he knows to deliver it to 3. When 3 receives the message, he checks the recipient attribute to know that he is from device 1. This extra layer allows you to send and receive messages through other devices and still know who it is from.

-, , . , 1-2-3-4, , , , , 2 ? ? , ? peer-to-peer , , , .
, !

+4

Bluetooth, , IRC XMPP, .

(, ), Bluetooth, , .

0

All Articles