* [Bluez-users] simple rfcomm connect!?
@ 2004-10-22 6:36 R.Schade
2004-10-22 7:21 ` Fred Schaettgen
2004-10-22 10:51 ` Marcel Holtmann
0 siblings, 2 replies; 5+ messages in thread
From: R.Schade @ 2004-10-22 6:36 UTC (permalink / raw)
To: bluez-users
Hi,
I have two identical BT-Dongles and I want to make my first steps on
programming with bluez. For the first quick and dirty I tried to connect
these two dongles on different PCs over a RFCOMM channel. The server comes
up and is waiting, but the client breaks the connect with "Connection
refused". What can I do? How can I debug or find out more information about
whats going wrong? Can I switch to verbose output for the bluez-daemons?
Both PCs are on Debian Sarge 2.4.27 with whole bluez-stuff compiled in the
kernel and the additional bluez-packages. The "hcid.conf" and "pin" are
identical on both PCs, for testing the security is none. "l2ping" and the
other basic tests are working. "hciconfig -a" and "hcitool scan" looks good,
but sdptool browse xxxx shows only "L2CAP" on protocol-lists, no RFCOMM
(look at the end of email). All internet examples have the rfcomm on the
protocol list ??!
Thanks for your help,
Ralf
void BTserver(void)
{
int len = 0;
if ((ownsock = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)) <
0)
{
perror("socket!");
exit(1);
}
printf("Server-Socket: %d\n", ownsock);
if ( bind(ownsock, (struct sockaddr*)&ownaddr, sizeof(ownaddr)) < 0)
{
perror("bind!");
exit(1);
}
if (listen(ownsock, 10) < 0)
{
perror("listen!");
exit(1);
}
len = sizeof(remoteaddr);
if ((remotesock = accept(ownsock, (struct sockaddr*)&remoteaddr,
&len)) < 0)
{
perror("accept!");
exit(1);
}
printf("Server accept Socket: %d\n", remotesock);
}
void BTclient(void)
{
int len = 0;
if ((ownsock = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)) <
0)
{
perror("socket!");
exit(1);
}
printf("Client-Socket: %d\n", ownsock);
if ( bind(ownsock, (struct sockaddr*)&ownaddr, sizeof(ownaddr)) < 0)
{
perror("bind!");
exit(1);
}
len = sizeof(remoteaddr);
if ((remotesock = connect(ownsock, (struct sockaddr*)&remoteaddr,
len)) < 0)
{
perror("connect!");
exit(1);
}
printf("Client connects: %d\n", remotesock);
}
emg-rs-debian-mobil:~# sdptool browse 00:04:61:81:20:5F
Browsing 00:04:61:81:20:5F ...
Service Name: SDP Server
Service Description: Bluetooth service discovery server
Service Provider: BlueZ
Service RecHandle: 0x0
Service Class ID List:
"SDP Server" (0x1000)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 1
Version: 0x0001
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Service Name: Public Browse Group Root
Service Description: Root of public browse hierarchy
Service Provider: BlueZ
Service RecHandle: 0x804d050
Service Class ID List:
"Browse Group Descriptor" (0x1001)
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Bluez-users] simple rfcomm connect!?
2004-10-22 6:36 [Bluez-users] simple rfcomm connect!? R.Schade
@ 2004-10-22 7:21 ` Fred Schaettgen
2004-10-22 10:51 ` Marcel Holtmann
1 sibling, 0 replies; 5+ messages in thread
From: Fred Schaettgen @ 2004-10-22 7:21 UTC (permalink / raw)
To: bluez-users; +Cc: R.Schade
On Friday 22 October 2004 08:36, R.Schade@tu-braunschweig.de wrote:
> Hi,
>
> I have two identical BT-Dongles and I want to make my first steps on
> programming with bluez. For the first quick and dirty I tried to connect
> these two dongles on different PCs over a RFCOMM channel. The server comes
> up and is waiting, but the client breaks the connect with "Connection
> refused". What can I do? How can I debug or find out more information about
> whats going wrong? Can I switch to verbose output for the bluez-daemons?
Did you initialize ownaddr correctly? Try hcidump.
> Both PCs are on Debian Sarge 2.4.27 with whole bluez-stuff compiled in the
> kernel and the additional bluez-packages. The "hcid.conf" and "pin" are
> identical on both PCs, for testing the security is none. "l2ping" and the
> other basic tests are working. "hciconfig -a" and "hcitool scan" looks
> good, but sdptool browse xxxx shows only "L2CAP" on protocol-lists, no
> RFCOMM (look at the end of email). All internet examples have the rfcomm on
> the protocol list ??!
Listening on a rfcomm socket won't create a SDP-record automatically. You have
to create one yourself and register it with the sdp server. For testing you
can use "sdptool add". But as long as you don't search for a specific service
on the client side and connect to a hardcoded rfcomm channel, that won't make
a difference anyway.
Your output of sdptool shows only the record for the public browse group and
the sdp server itself. The latter is not using rfcomm, so rfcomm is not among
the protocol descriptors for this service, neither on your system nor
anywhere else. Try scrolling upwards a little in all those "internet
examples" ;)
regards
Fred
--
Fred Schaettgen
bluez-devel@schaettgen.de
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Bluez-users] simple rfcomm connect!?
2004-10-22 6:36 [Bluez-users] simple rfcomm connect!? R.Schade
2004-10-22 7:21 ` Fred Schaettgen
@ 2004-10-22 10:51 ` Marcel Holtmann
1 sibling, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2004-10-22 10:51 UTC (permalink / raw)
To: R.Schade; +Cc: BlueZ Mailing List
Hi Ralf,
> I have two identical BT-Dongles and I want to make my first steps on
> programming with bluez. For the first quick and dirty I tried to connect
> these two dongles on different PCs over a RFCOMM channel. The server comes
> up and is waiting, but the client breaks the connect with "Connection
> refused". What can I do? How can I debug or find out more information about
> whats going wrong? Can I switch to verbose output for the bluez-daemons?
run "hcidump -X" as root to see the details.
> Both PCs are on Debian Sarge 2.4.27 with whole bluez-stuff compiled in the
> kernel and the additional bluez-packages. The "hcid.conf" and "pin" are
> identical on both PCs, for testing the security is none. "l2ping" and the
> other basic tests are working. "hciconfig -a" and "hcitool scan" looks good,
> but sdptool browse xxxx shows only "L2CAP" on protocol-lists, no RFCOMM
> (look at the end of email). All internet examples have the rfcomm on the
> protocol list ??!
Show them to us and also show us the full source code. The ownsock
variable can't be an integer, but you treat it like an integer in the
printf statement. So either the type is wrong or you get a bunch of
compiler warnings that you are ignoring.
Regards
Marcel
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [Bluez-users] simple rfcomm connect!?
@ 2004-10-22 12:07 R.Schade
2004-10-22 12:53 ` Marcel Holtmann
0 siblings, 1 reply; 5+ messages in thread
From: R.Schade @ 2004-10-22 12:07 UTC (permalink / raw)
To: bluez-users
Hi Marcus,
> From: bluez-users-admin@lists.sourceforge.net
> [mailto:bluez-users-admin@lists.sourceforge.net]On Behalf Of Marcel
> Holtmann
>
> run "hcidump -X" as root to see the details.
Now it works here (I wrote it in an email to this list before), but I will
test my programm at home in the evening with hcidump.
> Show them to us and also show us the full source code. The ownsock
> variable can't be an integer, but you treat it like an integer in the
> printf statement. So either the type is wrong or you get a bunch of
> compiler warnings that you are ignoring.
The ownsock-variable is the return-code from socket() and this is an
integer?! Compiling with -Wall don't show me any warnings. Do you confuse
ownsock with the ownaddr, a variable from type struct sockaddr_rc?
In a former message you suggest a look on rctest-code. I look at the code
for learning.
Thank you,
Ralf
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [Bluez-users] simple rfcomm connect!?
2004-10-22 12:07 R.Schade
@ 2004-10-22 12:53 ` Marcel Holtmann
0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2004-10-22 12:53 UTC (permalink / raw)
To: R.Schade; +Cc: BlueZ Mailing List
Hi Ralf,
> > Show them to us and also show us the full source code. The ownsock
> > variable can't be an integer, but you treat it like an integer in the
> > printf statement. So either the type is wrong or you get a bunch of
> > compiler warnings that you are ignoring.
> The ownsock-variable is the return-code from socket() and this is an
> integer?! Compiling with -Wall don't show me any warnings. Do you confuse
> ownsock with the ownaddr, a variable from type struct sockaddr_rc?
oh yes, I messed that up. Sorry for that confusion, but why don't you
use standard variable names like sk, addr, sa etc. ;)
> In a former message you suggest a look on rctest-code. I look at the code
> for learning.
And look at "hciconfig -a" to check if you are in security mode 3 or
not.
Regards
Marcel
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-10-22 12:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-22 6:36 [Bluez-users] simple rfcomm connect!? R.Schade
2004-10-22 7:21 ` Fred Schaettgen
2004-10-22 10:51 ` Marcel Holtmann
-- strict thread matches above, loose matches on Subject: below --
2004-10-22 12:07 R.Schade
2004-10-22 12:53 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox