A atiaust Active Member Licensed User Longtime User May 3, 2016 #1 Hi Erel, I have a B4A app using a Bluetooth connection connected to an arduino board with an app written in B4R. When I send a text massage to the Arduino board it initiates a response back to the B4A app but only the first response is recieved as one line : ie You: Recieved all following responses appear as 2 lines ie You: R You: ecieved I am using Code: Copy Sub AStream_NewData (Buffer() As Byte) LogMessage("You", BytesToString(Buffer, 0, Buffer.Length, "UTF8")) Log("buffer lenght = " & Buffer.Length) End Sub I have read all the tutorials and issues relating to asyncstreams but can't see a straight forward way to fix. Any help appreciated. Thanks
Hi Erel, I have a B4A app using a Bluetooth connection connected to an arduino board with an app written in B4R. When I send a text massage to the Arduino board it initiates a response back to the B4A app but only the first response is recieved as one line : ie You: Recieved all following responses appear as 2 lines ie You: R You: ecieved I am using Code: Copy Sub AStream_NewData (Buffer() As Byte) LogMessage("You", BytesToString(Buffer, 0, Buffer.Length, "UTF8")) Log("buffer lenght = " & Buffer.Length) End Sub I have read all the tutorials and issues relating to asyncstreams but can't see a straight forward way to fix. Any help appreciated. Thanks
Erel B4X founder Staff member Licensed User Longtime User May 3, 2016 #2 atiaust said: Hi Erel, Click to expand... This is a community forum. Please don't limit your questions to a single member. This is how network communication works. You cannot rely on the message to arrive as a single "packet". You can use AsyncStreamsText and in B4R send the byte 10 at the end of each message. Upvote 0
atiaust said: Hi Erel, Click to expand... This is a community forum. Please don't limit your questions to a single member. This is how network communication works. You cannot rely on the message to arrive as a single "packet". You can use AsyncStreamsText and in B4R send the byte 10 at the end of each message.
A atiaust Active Member Licensed User Longtime User May 3, 2016 #3 Erel said: This is a community forum. Please don't limit your questions to a single member. This is how network communication works. You cannot rely on the message to arrive as a single "packet". You can use AsyncStreamsText and in B4R send the byte 10 at the end of each message. Click to expand... Sorry, did not mean to neglect the rest of the community. How do I add byte 10 to the message when you can't concatenate.. I understand this is part B4R question. Upvote 0
Erel said: This is a community forum. Please don't limit your questions to a single member. This is how network communication works. You cannot rely on the message to arrive as a single "packet". You can use AsyncStreamsText and in B4R send the byte 10 at the end of each message. Click to expand... Sorry, did not mean to neglect the rest of the community. How do I add byte 10 to the message when you can't concatenate.. I understand this is part B4R question.
Erel B4X founder Staff member Licensed User Longtime User May 3, 2016 #4 atiaust said: How do I add byte 10 to the message when you can't concatenate.. I understand this is part B4R question. Click to expand... Code: Copy AStream.Write(CurrentMessage) AStream.Write(Array As Byte(10)) Upvote 0
atiaust said: How do I add byte 10 to the message when you can't concatenate.. I understand this is part B4R question. Click to expand... Code: Copy AStream.Write(CurrentMessage) AStream.Write(Array As Byte(10))