public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* 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
* [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

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 12:07 [Bluez-users] simple rfcomm connect!? R.Schade
2004-10-22 12:53 ` Marcel Holtmann
  -- strict thread matches above, loose matches on Subject: below --
2004-10-22  6:36 R.Schade
2004-10-22  7:21 ` Fred Schaettgen
2004-10-22 10:51 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox