* [Bluez-users] Question re .bind() call on an RFCOMM socket
@ 2005-01-11 17:33 graeme.n.brown
2005-01-11 18:56 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: graeme.n.brown @ 2005-01-11 17:33 UTC (permalink / raw)
To: bluez-users
[-- Attachment #1: Type: text/plain, Size: 1090 bytes --]
Hi
I am trying to understand how bind() call to BlueZ RFCOMM socket
behaves .
Code ...
SNIP...
#include <bluetooth/bluetooth.h>
#include <bluetooth/rfcomm.h>
int main ()
{
int sock ;
bdaddr_t bdaddr ;
struct sockaddr_rc loc_addr;
SNIP ...
/** Assume we have BT address of a local BT interface in bdaddr **/
If ((sock = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)) < 0) {
printf("Cannot create socket: %s (errno: %d)\n", strerror(errno));
}
loc_addr.rc_family = AF_BLUETOOTH;
bacpy( &(loc_addr.rc_baddr), bdaddr);
/* Channel allocation */
loc_addr.rc_channel = 1;
/*** OR loc_addr.rc_channel = 0; ??? <= What effect would this have
??? ***/
if ( bind(sock, (struct sockaddr *) &loc_addr, sizeof(loc_addr)) < 0 ) {
printf("Cannot bind to socket: %s (errno: %d)\n", strerror(errno));
close(sock);
exit -1 ;
}
snip ...
}
If the loc_addr.rc_channel were set to 0, does the bind() call
automatically allocate an unused RFCOMM server channel ?
Thanks
Graeme Brown
[-- Attachment #2: Type: text/html, Size: 15602 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Bluez-users] Question re .bind() call on an RFCOMM socket
2005-01-11 17:33 [Bluez-users] Question re .bind() call on an RFCOMM socket graeme.n.brown
@ 2005-01-11 18:56 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2005-01-11 18:56 UTC (permalink / raw)
To: BlueZ Mailing List
Hi Graeme,
> I am trying to understand how bind() call to BlueZ RFCOMM socket
> behaves .
>
> If the loc_addr.rc_channel were set to 0, does the bind() call
> automatically allocate an unused RFCOMM server channel ?
if you use the latest kernel then it will select the next unused RFCOMM
channel.
Regards
Marcel
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-01-11 18:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-11 17:33 [Bluez-users] Question re .bind() call on an RFCOMM socket graeme.n.brown
2005-01-11 18:56 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox