martinohanlon / BlueDot

A zero boiler plate bluetooth remote
MIT License
141 stars 43 forks source link

Multiple comm: Bluetooth Comm API #150

Closed orionJag closed 4 years ago

orionJag commented 4 years ago

Describe the feature you'd like Currently using Bluetooth Comm API and I was wondering if multiple clients can send request to the server. I am using "bluedot.btcomm.BluetoothServer" and "bluedot.btcomm.BluetoothClient" API and when more than 1 clients makes a request, the subsequent client just hangs.

Not sure if this is a feature request, guess is I am missing some additional configuration to allow multiple connectivity to the Server.

Appreciate the help and support.

Thanks

martinohanlon commented 4 years ago

Bluetooth is a 1 to 1 connection. A server can only accept a single connection.

You could start multiple servers on different ports that way you could host multiple connections.

martinohanlon commented 4 years ago

For clarification btcomm is a 1 to 1 connection. I think it's technically possible to have multiple rfcomm connections with BT, although no idea if it is supported by pythons socket layer.

ukBaz commented 4 years ago

From https://docs.python.org/3/library/socket.html:

BTPROTO_RFCOMM accepts (bdaddr, channel) where bdaddr is the Bluetooth address as a string and channel is an integer.

So I think you would have to define each server to listen on a different channel.

martinohanlon commented 4 years ago

Thank you @ukBaz . In which case. @orionJag as I already said, you would have to use different ports.

orionJag commented 4 years ago

Martin & @ukBaz

       Thanks for such a quick response and clarification.  I will check out using different ports. 

       Appreciate all your support to the community.

Thanks