0

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

  • If you could isolate the error and give a more explicit description that would be nice. __Randomly__ fails is honestly a bit vague – cjds Jun 26 '15 at 22:04
  • @CarlSaldanha It is also very accurate in my case. I spent a lot of time trying to figure out if there was a common cause, but it seems to be actually random. As I said, the only factors that seem to have an impact are the time since the start of the test and the number of devices involved. When transmitting data between two devices only, however, it usually works fine. – Marco DallaG Jun 27 '15 at 09:21

0 Answers0