I have two Android devices. One is acting 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 doing what they want.
The client then attempts to connect to the server again to request another file. Right now I am getting a java.io.IOException: Device or resource busy
when attempting to connect (socket.connect()
). Is it because Bluetooth (on Android) only allows one channel between two devices? (if it were another device it would work but if it is the same it doesn't ?) 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 the case or not.
System: android 2.2.1 communicating with the bluecove bluetooth library.
Definitely not with the same UUID(universally UNIQUE Identifier).
Reference for that was taken from here
Maybe with more than one. You can connect multiple devices in the Server/Client style, you can try to set one of the devices as a server and start several clients on the other. My first guess would be to start several client threads, but you might have to find a way to change the MAC address for each of them.
Here you can find another discussion about how to change your mac address, but only works in rooted devices. I can't find anything else for non rooted ones. No idea on how to do this programmatically but it might give you a start.
Here there is a discussion about connecting several clients at the same time in a server. I got there from this question. ( I think this might be your closest shot)
Here you have a discussion about peer-to-peer networks.
AFAIK, multiple connectivity is not possible in case of Bluetooth Connection. Bluetooth is Connectivity API is by default Synchronized so only one connection at a time is possible. So you can not perform multiple connections.
However it can be possible in another way like making one connection , performing 2 seconds operation on it and then creating another connection and performing 2 seconds operations like in normal multitasking operating system happens.
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