Can you establish several Bluetooth connections between the same two devices in Android?

I have two Android devices. One works as a server, and the other as a client. The client connects to the server and requests a file - this is done in one thread on the client and one thread on the server so that both can continue to do what they want.

The client then tries to reconnect to the server to request another file. Right now I get java.io.IOException: Device or resource busy when trying to connect ( socket.connect() ). Is it because Bluetooth (on Android) allows only one channel between two devices? (if it was a different device, it would work, but if it is the same as not?) Note that both attempts are made with the same service name and UUID.

Even if the error is specific to my code, I would like to know if this is true or not.

System: Android 2.2.1, interacting with the bluecove bluetooth library.

+6
source share
2 answers

AFAIK, when connecting Bluetooth, it is not possible to establish multiple connections. Bluetooth is the default connection interface. Synchronized, so only one connection at a time is possible. Therefore, you cannot make multiple connections.

However, this may be possible in a different way, like creating one connection, executing on it for two seconds, and then creating another connection and performing two-second operations, as in a conventional multitasking operating system.

+1
source

Definitely not with the same UUID (Generic UNIQUE Identifier).

The link to this was taken from here.

Perhaps with a few. You can connect several devices in the Server / Client style, you can try to install one of the devices as a server and run several clients on the other. My first guess would be to start several client streams, but you might have to find a way to change the MAC address for each one.

Here you can find another discussion on how to change your MAC address, but only works on root devices. I cannot find anything else for the undisturbed. I don’t know how to do this programmatically, but it can give you a start.

It discusses the simultaneous connection of multiple clients on the server. I got from this question . (I think this might be your closest shot)

Here you have a discussion about peer-to-peer networks.

+6
source

Source: https://habr.com/ru/post/911470/


All Articles