I currently have a client / server pair encoded with PyBlueZ. Right now, the server can connect to serial clients - it will work until it is completed with the client, after which it will begin to listen to another client.
However, I really want to run client communication in separate threads in order to have multiple clients at the same time. However, when I try to connect to the 2nd client, PyBlueZ advertises the same port that the first client uses. I configure such connections as follows:
self.port = bluetooth.PORT_ANY print "Accepting clients..." self.server_sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM ) self.server_sock.bind(("",self.port)) self.server_sock.listen(5) print "listening on port %d" % self.port bluetooth.advertise_service( self.server_sock, MY_SERVICE, MY_UUID ) client_sock,address = self.server_sock.accept() print "Accepted connection from ",address commThread = ServerThread(client_sock, self.bn_id, self.bn_name, self.bn_thumbnail)
Again, this code is great for serial connections, but when I try it in parallel, my client receives a βbusyβ response from the bluetooth server system. On the client side, I display the port to which it is trying to connect, and it always shows port "1".
Is there a limitation in PyBlueZ that allows only one connection? Or am I doing something wrong for parallel connections?
source share