Binding RFCOMM sockets

Maksim Yevmenkin maksim.yevmenkin at gmail.com
Tue Aug 21 09:51:26 PDT 2007


Hello,

> I'm currently trying to implement a server over the RFCOMM layer, and at least
> my imagination told me that connecting to channel 0 should select "any" free
> RFCOMM channel (at least that's what I gathered from the BlueZ documentation,
> which of course has nothing to do with the FreeBSD bluetooth stack, but
> anyway ;-)).

this is not currently implemented in freebsd

> Anyway, binding to the 0 channel succeeds (with getsockname getting back the 0
> channel afterwards even though the socket is [supposedly] bound), but calling
> listen() then gives me a EDESTADDRREQ, which I can't really sort into the
> problem, as it isn't documented in man 2 listen either.

basically it is trying to tell you that local address is invalid.

> I've not tried to bind to a specific channel (yet), but anyway, just wanted to
> ask you guys whether there is any proper "protocol" for binding to a wildcard
> (free) RFCOMM channel using the standard socket API (and no, I don't actually
> want to test each channel whether it's free, which was necessary with an
> older version of BlueZ, at least according to their API documentation).

like i said, this is currently not supported. wildcard addressing
currently only supported for

1) bd_addr's (both incoming and outgoing connections for rfcomm and l2cap)

2) channel/psm (only for outgoing connections for rfcomm/l2cap)

the assumption i made here is that server needs to know exact rfcomm
channel to listen on. mostly because i was not sure how to deal with
wildcard addressing when multiple bluetooth devices connected to the
same system.

anyway, i will put this on my todo list and hopefully will get to it.
no promises though :) you are welcome to submit patches btw. i will be
more than happy to review and commit them for you.

thanks,
max


More information about the freebsd-bluetooth mailing list