2016年1月14日 星期四

[RR Python] PyBluez Example, rfcomm-server.py Problem with running RFCOMM server on PORT_ANY

I always get error "_bluetooth.error: (98, 'Address already in use')" while running PyBluez example rfcomm-server.py,

The code piece is:
server_sock=BluetoothSocket( RFCOMM )
server_sock.bind(("",PORT_ANY))
server_sock.listen(1)

it's apparent that the listening port is occupied by someone since I can run it successfully if changing the port number from PORT_ANY to 2 or 3.

GoogleCodeExporter explains the issue, which might be caused by pnat server. Per discussion1 and discussion2, disabling pnat plugin in bluetooth config works. BEWARE that restart bluetooth service somehow doesn't work though, I have to reboot to make it enabled

in  /etc/bluetooth/main.confadd/append DisablePlugins = pnat
There is still question that HOW TO FIGURE OUT WHICH SERVICE/SERVER OCCUPIED WHAT PORT!!!


沒有留言:

張貼留言