Skip to content

Instantly share code, notes, and snippets.

@exallium
Created January 10, 2012 19:17
Show Gist options
  • Save exallium/1590598 to your computer and use it in GitHub Desktop.
Save exallium/1590598 to your computer and use it in GitHub Desktop.
rfcomm
import bluetooth
server_sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM )
port = bluetooth.get_available_port( bluetooth.RFCOMM )
server_sock.bind(("",port))
server_sock.listen(1)
print "listening on port %d" % port
uuid = "00001101-0000-100­0-8000-00805F9B34FB"
bluetooth.advertise_service( server_sock, "FooBar Service", uuid )
client_sock,address = server_sock.accept()
print "Accepted connection from ",address
data = client_sock.recv(1024)
print "received [%s]" % data
client_sock.close()
server_sock.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment