Skip to content

Instantly share code, notes, and snippets.

@kevindoran
Last active December 7, 2021 21:25
Show Gist options
  • Select an option

  • Save kevindoran/5428301 to your computer and use it in GitHub Desktop.

Select an option

Save kevindoran/5428301 to your computer and use it in GitHub Desktop.
A simple Python script to send messages to a sever over Bluetooth using Python sockets (with Python 3.3 or above).
"""
A simple Python script to send messages to a sever over Bluetooth using
Python sockets (with Python 3.3 or above).
"""
import socket
serverMACAddress = '00:1f:e1:dd:08:3d'
port = 3
s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)
s.connect((serverMACAddress,port))
while 1:
text = input()
if text == "quit":
break
s.send(bytes(text, 'UTF-8'))
s.close()
@Kamran-Dev
Copy link
Copy Markdown

Error: Cannot find reference 'BTPROTO_RFCOMM' in 'socket.pyi'

I am using Python 3.9 on Windows 11. Please help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment