Skip to content

Instantly share code, notes, and snippets.

@AuraLoredana
Created March 17, 2022 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AuraLoredana/7533a48cb4e4c80e4cc0e84b68d1112e to your computer and use it in GitHub Desktop.
Save AuraLoredana/7533a48cb4e4c80e4cc0e84b68d1112e to your computer and use it in GitHub Desktop.
rfcomm-client
import bluetooth
hostMACAddress =” 88:1B:99:0C:23:0F”
port = 22
backlog = 1
size = 1024
s = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
s.bind((hostMACAddress, port))
s.listen(backlog)
try:
client, clientInfo = s.accept()
while 1:
data = client.recv(size)
if data:
print(data)
client.send(data)
except:
print("Closing socket")
client.close()
s.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment