Android Question Bluetooth chat AStream_NewData buffer is always 1 byte long first

jimseng

Active Member
Licensed User
Longtime User
Hello
When sending a string from python on a raspberry pi via bluetooth to the chat example the message is always 1 character followed by the rest of the characters.
For instance ser.write('hello'.encode('utf-8')) from the pi gives two AStream_NewData events. So what is output is:
h
ello
And it doesn't seem to matter what length the string I send is, or if it contains a carriage return.
Any ideas?
 

jimseng

Active Member
Licensed User
Longtime User
I think I have got it. AsyncStreamsText seems to be the answer. Still. Not sure why I get 1 byte then the rest. An explanation might help me but at least it is working with AsyncStreamsText
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
Don't worry about it. Asynchronous streams normally arrive in bursts - that is how they got their name. The length of the bursts depends on the characteristics of the transmission path.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…