From: Marcel Holtmann <marcel@holtmann.org>
To: bluez-devel@lists.sourceforge.net
Subject: Re: [Bluez-devel] read data from one device to another over rfcomm
Date: Sun, 17 Jul 2005 15:28:14 +0200 [thread overview]
Message-ID: <1121606894.22662.1.camel@pegasus> (raw)
In-Reply-To: <20050714093139.3323.qmail@web52814.mail.yahoo.com>
Hi Naved,
> I am developing some applications using BlueZ. The
> developer board is Axis Developer 82+.
>
> The following is the code for one of the functions.
> Basically, there are two axis boards, one is acting as
> a server, the other, a client. Upon establising a
> connection with the server, the client receives a menu
> that shows the actions it can take: run a command on
> the other server, receive a file from the server, send
> a file to the server.
>
> This is the code for the client after connecting to
> the server:
>
> while (1)
> {
> memset (optn_buff, 0, 3 );
>
> printf ("What do you want to do (type in
> the option number)? Press CTRL-C for hang-up\n");
> printf ("\t(1) Run a command\n");
> printf ("\t(2) Transfer a file from here to
> there\n");
> printf ("\t(3) Transfer a file from there to
> here\n");
>
> gets(optn); // get
> option
>
> optn_int = atoi(optn);
>
> if (optn_int < 1 || optn_int > 3)
> {
> printf ("Choose the option that's
> given\n\n");
> continue;
> }
>
> optn_str = sprintf(optn_buff, "%d", optn_int);
> // convert optn to string
> chk_write = write (sk, optn_buff, optn_str);
> // send optn to server
>
> switch (optn_int)
> {
> case 1:
> rcmdc (sk); //
> run command on server
> break;
> case 2:
> snd (sk); //
> send file from here
> break;
> case 3:
> rec (sk); //
> receive file from there
> break;
> }
> }
>
> optn_buff is an array of unsigned char type, of size
> 3. It sends the choice made by the client to the
> server.
>
> The following is the code from the server:
>
> while (1)
> {
> memset (optn_buff, 0, 3 );
>
> chk_read = read (sk, optn_buff, 1);
> // read option chosen by the client
> optn = atoi(optn_buff);
> // convert buffer data to int
>
> switch (optn)
> {
> case 1:
> rcmds (sk); //
> run command on server
> break;
> case 2:
> rec (sk); //
> receive file
> break;
> case 3:
> snd (sk); //
> send file
> break;
> }
> }
>
> After connection is made, the server waits to receive
> the instruction to be executed as requested by the
> client.
>
> The problem I am facing is with the read statements:
> The devices do not read what's being sent to them.
> The queer thing is, if I use the same code to connect
> and play with a phone, the read statements execute. I
> have been able to send and receive data (using read
> and write as above) with a number of phones. So, the
> boards can't read when they are being written to, but
> the phones can read when they're being written to.
you must have a bug somewhere, because the RFCOMM is a real duplex
stream and it is working perfect. Do you use the latest kernel? Do you
checked with "hcidump -X -V" what happens on each side?
Regards
Marcel
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
prev parent reply other threads:[~2005-07-17 13:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-14 9:31 [Bluez-devel] read data from one device to another over rfcomm Naved Aziz
2005-07-17 13:28 ` 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=1121606894.22662.1.camel@pegasus \
--to=marcel@holtmann.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox