python - OSError with Pybluez librairy -
i make bluetooth communication between laptop bluetooth dongle , windows 7, , raspberry pi 3.
i found on internet tutorials use pybluez librairy doesn't work me.
find below code server part :
import bluetooth host = "" port = 12 hostaddr = (host, port) def setupserver(): server_socket=bluetooth.bluetoothsocket( bluetooth.rfcomm ) print("socket created.") server_socket.bind(hostaddr) server_socket.listen(1) print("socket bind complete") client_sock, client_info = server_socket.accept() print("accepted connection " , client_info) try: while true: data = client_sock.recv(1024) if len(data) == 0: break print("received [%s]" %data) except ioerror: pass print("disconnected") client_sock.close() server_socket.close() print("all done")
setupserver()
this output :
socket created. traceback (most recent call last): file "path_to_file\server.py", line 33, in <module> setupserver() file "path_to_file\server.py", line 12, in setupserver server_socket.bind(hostaddr) file "c:\python34\lib\site-packages\bluetooth\msbt.py", line 60, in bind bt.bind (self._sockfd, addr, port) oserror
do have idea why had error ?
Comments
Post a Comment