Binding RFCOMM sockets
Heiko Wundram (Beenic)
wundram at beenic.net
Thu Aug 23 01:59:23 PDT 2007
Am Mittwoch 22 August 2007 23:21:51 schrieb Maksim Yevmenkin:
> On 8/21/07, Iain Hibbert <plunky at rya-online.net> wrote:
> > nor in NetBSD - out of interest though, what is this server trying to
> > achieve? It does not seem especially useful to listen on 'any' channel,
> > given the way that bluetooth service discovery works..
>
> well, the idea, imo, is when a server binds to 'any' channel (or psm),
> the kernel will automatically assign first available one. next, the
> application calls getsockname(2) to obtain the actual channel (or psm)
> that was assigned by the kernel and registers that channel (or psm)
> with sdp.
>
> this simplifies resource (i.e. channel or psm) management when
> multiple applications are trying to provide multiple services at the
> same time. basically you do not have to worry about assigning channels
> (or psm's) by hand.
This is exactly what I had in mind. Generally, what I'm currently building is
an OBEX service framework which depending on the channel the remote
application connects to should offer differing kinds of backend services.
As the services themselves are fairly independent, I generally found the idea
to have the kernel decide which channel to use for a specific was pretty much
similar to what the portmapper does for TCP/IP, where a listening socket is
bound if it wasn't on the listen command, and you can then retrieve the local
address using getsockname() to register that port with the portmapper.
Anyway, as you said you'd accept a patch from me, I'm currently trying to hack
this into my 6.2-STABLE. I'll be able to tell you whether I'll manage to get
this working by the end of the weekend; (FreeBSD) kernel-programming is
utterly new for me. ;-)
--
Heiko Wundram
Product & Application Development
More information about the freebsd-bluetooth
mailing list