From: Marcel Holtmann <marcel@holtmann.org>
To: bluez-users@lists.sourceforge.net
Subject: Re: [Bluez-users] RFCOMM Connection Handy to Bluez Application on Linux
Date: Thu, 19 May 2005 15:07:30 +0200 [thread overview]
Message-ID: <1116508050.24921.21.camel@pegasus> (raw)
In-Reply-To: <1710546273@web.de>
Hi Marius,
> I need some help. I try to connect my Java Handy Application with my Bluez Bluetooth Application on Linux. I will start a serial connection between both devices (RFCOMM).
> For my Test I found this Code for an Bluetooth Server:
>
> #include <netinet/in.h>
> #include <arpa/inet.h>
> #include <sys/types.h>
> #include <sys/socket.h>
>
> #include <bluetooth/bluetooth.h>
> #include <bluetooth/rfcomm.h>
>
> #define CHANNEL 4
> #define QUEUE 10
>
> int main(void)
> {
> int sock, client, alen;
> struct sockaddr_rc addr;
>
> sock = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
> if(sock < 0)
> {
> perror("socket");
> exit(1);
> }
>
> addr.rc_family = AF_BLUETOOTH;
> bacpy(&addr.rc_bdaddr, BDADDR_ANY);
> addr.rc_channel = htobs(CHANNEL);
> alen = sizeof(addr);
>
> if(bind(sock, (struct sockaddr *)&addr, alen) < 0)
> {
> perror("bind");
> exit(1);
> }
>
> listen(sock,QUEUE);
> printf("Waiting for connections...\n\n");
>
> while(client = accept(sock, (struct sockaddr *)&addr, &alen))
> {
> printf("Got a connection attempt!\n");
> close(client);
> }
>
> close(sock);
> return 0;
> }
>
> On my Handy I'm programming the Client in Java unsing JSR 82. In my Application I can find the Linux Device, but if I'm scanning for services (RFCOMM) there will be found no services!
> If I scan my Windows Laptop with the same Application, there are many services. Like this:
> btspp://000B7C59C010:1,encrypt=false;authenticate=false;master=false
> btspp://000B7C59C010:2,encrypt=false;authenticate=false;master=false
> btspp://000B7C59C010:3,encrypt=false;authenticate=false;master=false
> ...
>
> What I'm doing wrong?!
you need to register a SDP service record for your server. Example for
this can be found in pand and sdptool.
Regards
Marcel
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
prev parent reply other threads:[~2005-05-19 13:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-19 12:07 [Bluez-users] RFCOMM Connection Handy to Bluez Application on Linux Mariusz Dziuba
2005-05-19 13:07 ` Marcel Holtmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1116508050.24921.21.camel@pegasus \
--to=marcel@holtmann.org \
--cc=bluez-users@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.