From: Naved Aziz <no2alikebd@yahoo.com>
To: bluez-devel@lists.sourceforge.net
Subject: [Bluez-devel] read data from one device to another over rfcomm
Date: Thu, 14 Jul 2005 02:31:39 -0700 (PDT) [thread overview]
Message-ID: <20050714093139.3323.qmail@web52814.mail.yahoo.com> (raw)
Hi,
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.
Has anyone faced problems of this sort? Please spare
a minute of your time for me if you have.
Thanks and sincerely,
Naved
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
next reply other threads:[~2005-07-14 9:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-14 9:31 Naved Aziz [this message]
2005-07-17 13:28 ` [Bluez-devel] read data from one device to another over rfcomm 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=20050714093139.3323.qmail@web52814.mail.yahoo.com \
--to=no2alikebd@yahoo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox