title: android bluetooth serversocket with python-bluez client
body: <p>I am trying to connect my laptop(as client) to my android phone(as listener) using python-bluez on the laptop and android-bluetooth API on the phone.  </p>
  
  <p>I use the following code for my phone:</p>
  
  <pre><code>BluetoothServerSocket tmp = badapter.listenUsingRfcommWithServiceRecord(
      badapter.getName(), MY_UUID);
  BluetoothServerSocket bserversocket = tmp;
  if(bserversocket != null)
  {
      BluetoothSocket acceptsocket = bserversocket.accept(timeout);   
  }
  //timeout is set to about 15 sec
  if(acceptsocket != null)
  {
      out.append("got the connection...\n");   
  }
  </code></pre>
  
  <p>and the following in python for my laptop client:</p>
  
  <pre><code>from bluetooth import *
  
  btooth_addr = "38:EC:E4:57:1F:1B"
  
  sock = BluetoothSocket(RFCOMM)
  sock.connect((btooth_addr, 2))
  
  print "Connected"
  sock.close()
  </code></pre>
  
  <p>the listener time-outs without acknowledging any connections from the laptop, while the sender moves on to print 'Connected' on all attempts on different ports.</p>
  
  <p>the problem is that I don't know and can't set the port/channel the android phone is listening on, and also that I am required to fill in a port number as second argument of 'connect'(2 in this snippet). </p>
  
  <p>please help me out - my sole goal at this time is to get the connection attempt acknowledged by the phone.</p>