nadeesha5814 / pybluez

Automatically exported from code.google.com/p/pybluez
GNU General Public License v2.0
0 stars 0 forks source link

Problem with running RFCOMM server on PORT_ANY on debian OS #57

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. run bluetooth-agent  on server host
2. rfcomm-server.py on server host
3. connect from another host using rfcomm-client.py 

What is the expected output? What do you see instead?
"Accepted connection from ..."

What version of the product are you using? On what operating system?
0.18 on Debian Wheezy (B3) using Python 2.6 or Python 2.7

Please provide any additional information below.

According the client I'm connected!:

$ python rfcomm-client.py XX:XX:XX:XX:XX:XX
Searching for SampleServer on XX:XX:XX:XX:XX:XX
connecting to "SampleServer" on XX:XX:XX:XX:XX:XX
connected.  type stuff

However, rfcomm-server.py diagrees (accept() never returns) :

$ python2.6 rfcomm-server.py 
Waiting for connection on RFCOMM channel 1
(.... Nothing)

Original issue reported on code.google.com by geoff.fl...@gmail.com on 11 Nov 2012 at 4:28

GoogleCodeExporter commented 8 years ago
I was able to get it working by changing PORT_ANY to 3.... I think maybe the 
example should be changed?

Original comment by geoff.fl...@gmail.com on 11 Nov 2012 at 5:22

GoogleCodeExporter commented 8 years ago
Finally!!!!  This worked for me as well.  It looks like the PORT_ANY was 
picking a number that already represented a service running on my server's 
Bluetooth.

3 might not be the secret sauce for everyone, but putting in an ID that isn't 
currently being used did fixed my problem.

Original comment by lukedu...@gmail.com on 1 Aug 2013 at 11:37

GoogleCodeExporter commented 8 years ago
The problm is that sever uses already taken port.
Needs investigation where the issue is - pybluez or bluez
And if there is similiar issue on Windows?

Original comment by karu...@wp.pl on 19 Jan 2014 at 6:04

GoogleCodeExporter commented 8 years ago
Just an update on Windows PORT_ANY works fine and returns next available port.

On linux it works like this:
 - _get_available_port from bluez.py is run for PORT_ANY and it just tries to bind to ports from 1 to 30.
 - bind return value in C code is properly handled by PyErr_SetFromErrno(in btmodule.c)

And it is possible to make example rfcomm-server.py run on already taken port - 
see attached log with inquiry.

So it needs confirmation but looks like issue in bluez

Original comment by karu...@wp.pl on 2 Feb 2014 at 8:22

Attachments:

GoogleCodeExporter commented 8 years ago
Just for reference:
https://bugs.launchpad.net/ubuntu/+source/bluez/+bug/897255

It seems it is reproducible on lightblue too,
and the issue is just with port 1

Original comment by karu...@wp.pl on 2 Feb 2014 at 10:16

GoogleCodeExporter commented 8 years ago
Issue 61 has been merged into this issue.

Original comment by karu...@wp.pl on 16 Jul 2014 at 3:58

GoogleCodeExporter commented 8 years ago

Original comment by karu...@wp.pl on 10 Feb 2015 at 11:01