Bluetooth socket constantly timing out

128 views Asked by At

I am developing a few tests to compute metrics about Bluetooth connections on Android.

My problem is that randomly the socket fails to connect to the remote device, especially when more than two devices are involved. Specifically, most of the time, when I try to open a socket, I get the infamous error

connect read failed, socket might closed or timeout, read ret: -1

I already tried to apply the fix that involves java reflection, and it didn't work.

The test I am trying to develop involves sending a token in a ring of devices while performing some measurements. The probability that this problem occurs increases over time. The first tests may give some results, but eventually they usually fail.

Is anyone else suffering from the same problem?

For those who are interested, the code (developed in Kotlin) is here:

GitHub project

The code involved with the test itself

0

There are 0 answers