From: Rui Silva <rukinhas@gmail.com>
To: bluez-devel@lists.sourceforge.net
Subject: Re: [Bluez-devel] help needed with rfcomm
Date: Thu, 25 Aug 2005 14:43:37 +0100 [thread overview]
Message-ID: <259637e05082506435fb9a5fc@mail.gmail.com> (raw)
In-Reply-To: <1124916916.8019.20.camel@pegasus>
On 8/24/05, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Rui,
>=20
> > i tried to post these doubts under the bluez-users mailing list, but i
> > did'nt have any response, and since it has a programing doubt, i'll
> > try to explain my problem.
> >
> > i want to buil an aplication that listen on rfcomm bluetooth sockets
> > and the same aplication receives information thru that socket. i kinda
> > have a squeleton of the program as folows:
> >
> >
> > // cria o socket
> > if( (sock =3D socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)=
)
> > < 0){
> > perror("socket");
> > return(-1);
> > }
> >
> > // op=E7=F5es do socket
> > addr.rc_family =3D AF_BLUETOOTH;
> > str2ba(argv[1],&addr.rc_bdaddr);
> > addr.rc_channel =3D htobs(CHANNEL);
>=20
> the htobs() is wrong here. The channel is uint8 value and thus a endian
> change is not needed.
>=20
> > alen =3D sizeof(addr);
> >
> > //regista o socket no SO
> > if(bind(sock, (struct sockaddr *)&addr, alen) < 0){
> > perror("bind");
> > return(-1);
> > }
> > //poe o socket =E0 escuta
> > listen(sock,QUEUE);
> >
> > printf("Waiting for connections...\n\n");
> >
> > while (1){
> > while((client =3D accept(sock, (struct sockaddr *)&addr=
,
> > &alen)) !=3D -1){
> > printf("Got a connection attempt!\n");
> >
> > memset(buffer, 0, TAM_BUFFER);
> >
> > if ( (r =3D read(client, buffer, TAM_BUFFER)) <=
0
> > ){
> > perror("Read no server");
> > }
> >
> > but i can't get the connections to this computer to work. a i don't kno=
w why.
> >
> > another problem that i had was that the SPP profile has not
> > advertized, and i solved that problem by performing a "sdptool add
> > SP".
> >
> > anyway, with or without my program, i can't get the computer to accept
> > the connection attemps from other computers. these connections are
> > made using rfcomm on channel 1, and i can't change that.
> > my kernel was all the bluez stuff compiled in, not as modules.
> >
> > any sugestions will be apreciated
> >
> > so any ideia on how to solve this problem. I lacking time to
> > accomplish this program so i would really aprecciate all the hep that
> > you can give me..
>=20
> Run "hcidump -X -V" to see what happens. Run "sdptool browse local" to
> see what channel is advertised for your serial port service.
>=20
> Regards
>=20
> Marcel
i tried your changes but it didn't help. i thank anyway for your help
i solved my problem at least for now. I've changed SOCK_STREAM to
SOCK_RAW and the connections were accepted.
--=20
Rui Silva
Powered by Gentoo Linux under :
CELERON 1000 - Stage1 install with nptl
Pentium M 1800GHz - Stage1 install with NPTL
http://rukinhas.no-ip.org
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
next prev parent reply other threads:[~2005-08-25 13:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-24 19:21 [Bluez-devel] help needed with rfcomm Rui Silva
2005-08-24 20:43 ` [Bluez-devel] " Rui Silva
2005-08-24 20:56 ` Marcel Holtmann
2005-08-24 20:55 ` [Bluez-devel] " Marcel Holtmann
2005-08-25 13:43 ` Rui Silva [this message]
2005-08-25 14:29 ` Marcel Holtmann
2005-08-26 13:35 ` Rui Silva
2005-08-26 20:56 ` Rui Silva
2005-08-26 21:02 ` Albert Huang
2005-08-27 12:55 ` Marcel Holtmann
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=259637e05082506435fb9a5fc@mail.gmail.com \
--to=rukinhas@gmail.com \
--cc=bluez-devel@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.