[Bluez-users] Major slowdown when service discovery+opening a service happens on two systems trying to talk to each other

Marc-Andre Laverdiere-Papineau
2004-02-15T01:20:41Z

Hello all!

I'm working on an application where every Bluetooth device is trying to
scan for every other one around, and check if it runs my custom service.
At the same time, said service is running in another thread, waiting to be
connected to.

I am using Rococo with Bluez. Kernel RH2.4.28, latest version of BlueZ.
Belkin FT003 dongles.

When I have one computer having the service opened+performing the scan,
while the other just performs the scan, things go fine. The scans are
timely and I can send a message.

However, then I have both computers running the service+the service scan,
things slow down to a crawl. Actually, it depends on its mood.
It can take a full minute to have a device scan and a service scan
completing, or less than 20 seconds! Sometimes, computer a will be able
to detect computer b, while B still shows no sign of life.

On top of things, if I manage to get it to send a message to its peer, the
peer will get an Exception :( I was able to fix this by preventing the
application from doing a service scan at the moment it would send, but
that didn't fix the weird behaviour on service discovery. This hackaround
is not sturdy and I don't like it as a general thing.

Has such thing ever happened to any of you? What can I do to fix it?

It looks like Bluetooth won't let me open a connection while doing a
service scan. Is there limitations on what can be running simultaneously?
It looks like service scan + opening connections is no good. Should I
know other ones like that?

Thanks

MA