1

I am trying to connect and send data from my laptop to my Android phone via Bluetooth. I am using PyBluez library for that. When I am trying to call 'connect' method of BluetoothSocket:

sock=BluetoothSocket( RFCOMM )
sock.connect((host, port))

it always gives me the same error:

Traceback (most recent call last):
  File "rfcomm-client.py", line 41, in <module>
    sock.connect((host, port))
  File "<string>", line 5, in connect
bluetooth.btcommon.BluetoothError: (22, 'Invalid argument')

As I understood from docs and examples, the type of host should be String, and port should be int. That I checked.

I also checked the validity of both port and host, and already paired my devices.

Could anybody help me with this issue?

RadioLog
  • 582
  • 1
  • 4
  • 20
  • What are the values for `host` and `port`? As far as I can guess, that's where the error most likely orinates from. – Roman Riesen Apr 08 '17 at 13:11
  • 1
    @RomanRiesen I also think so. The address (as I found in examples), should be Bluetooth MAC address of the device as a String. Port should be integer. So the address is something like : 'zz:xx:cc:vv:bb:nn' – RadioLog Apr 08 '17 at 13:17

0 Answers0