2004-06-01 11:16:21

by Didier Santos Alves

[permalink] [raw]
Subject: [Bluez-devel] Problems while sending and receiving with rfcomm sockects

Hello,

I'm writting a server-client application over bluez using rfcomm sockets.=
I've
created two threads: one for sending and the other for receiving. The pro=
blem
occurs sometimes (sporadical) and only when I'm sending and receiving dat=
a at
the same time: The received data seems to be corrupt... Do I have to use
mutexes or other synchronizing method? The error ocurrs more often if I e=
xecute
more than one server at the same time.

Thanks.

PS: Please tell me if I'm sending this message to the right mailing list.=
..

Didier.



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel


2004-06-01 14:31:07

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] Problems while sending and receiving with rfcomm sockects

Hi Collin,

> > I never used RFCOMM in a multi-threaded program. Actually I avoid to
> > use threads wherever possible. However sending and receiving at the
> > same time should work. Maybe there is a kernel bug, what version do
> > you use?
>
> I allways thought one should ONLY use a socket within a single thread
> at the same time. I write my programs in that way that I never call
> read() and write() on a specific socket at the "same time" also I
> only access each socket within a single thread.

this is why we have select() and poll().

> Somehting else: I need a UUID for my application - any hints on where to
> find some information/instructions?

You must create a UUID-128. There was note in the specification about
that, but I can't remember it.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-06-01 12:56:16

by Collin R. Mulliner

[permalink] [raw]
Subject: Re: [Bluez-devel] Problems while sending and receiving with rfcomm sockects

Hi,

> I never used RFCOMM in a multi-threaded program. Actually I avoid to
> use threads wherever possible. However sending and receiving at the
> same time should work. Maybe there is a kernel bug, what version do
> you use?

I allways thought one should ONLY use a socket within a single thread
at the same time. I write my programs in that way that I never call
read() and write() on a specific socket at the "same time" also I
only access each socket within a single thread.

Somehting else: I need a UUID for my application - any hints on where to
find some information/instructions?


... Collin

--
Collin R. Mulliner <[email protected]>
BETAVERSiON Systems [http://www.betaversion.net]
info/pgp: finger [email protected]
Sun light is good, if it stays outside of my room!


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-06-01 12:34:27

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] Problems while sending and receiving with rfcomm sockects

Hi Didier,

> I'm writting a server-client application over bluez using rfcomm sockets. I've
> created two threads: one for sending and the other for receiving. The problem
> occurs sometimes (sporadical) and only when I'm sending and receiving data at
> the same time: The received data seems to be corrupt... Do I have to use
> mutexes or other synchronizing method? The error ocurrs more often if I execute
> more than one server at the same time.

I never used RFCOMM in a multi-threaded program. Actually I avoid to use
threads wherever possible. However sending and receiving at the same
time should work. Maybe there is a kernel bug, what version do you use?

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel