Last active
December 7, 2021 21:25
-
-
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| 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() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error: Cannot find reference 'BTPROTO_RFCOMM' in 'socket.pyi'
I am using Python 3.9 on Windows 11. Please help.