I created simple bluetooth RFCOMM server on Python 3
Here is my code:
import bluetooth
class Bluetooth:
def __init__(self, port, backlog, size):
#backlog = number of users who can connect to socket at the same time
#size = message size
s = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
s.bind(("", port)) #(mac addres, port)
s.listen(backlog)
print("Server is active, waiting for connection!")
while True:
client, clientInfo = s.accept()
print("Connected with :", clientInfo)
try:
while True:
data = client.recv(size)
if data:
print(data)
except:
print("Closing socket")
client.close()
print("Waiting for connection!")
s.close()
print("Server closed!")
When I send data from android device app like BlueTerm, BlueTerm2, Bluetooth Terminal (...) I get b'my string'
Screenshot from PyCharm
What does the b
sign preceding my text data mean?
How I can print only my string?