B4J Question Astream split print

rodmcm

Active Member
Licensed User
Hi
I'm using Erel's tutorial "[B4X] Network + AsyncStreams + B4XSerializator" to send data from an
ESP32 to my PC ( learning for me)

For the experiment I have triggered an ESP32 to send a string "12345" as individual characters
on receipt of a serial input. I print out the character received from the serial to make sure there is only one
'send' command.

ESP32 Code ( arduino format)
while(Serial.available())
{
char inChar=Serial.read();
Serial.write(inChar);
String s="12345";
for (int i=0;i<s.length();i++)
client.write(s);
Serial.flush();
}


Modified New Data
' Text Received, converted to string and displayed
Sub AStream_NewData (Buffer() As Byte)
TxtRecieved.Text="" 'clear existing text
TxtRecieved.Text=BytesToString(Buffer,0,Buffer.Length,"UTF8") 'write buffer as string
Log(BytesToString(Buffer,0,Buffer.Length,"UTF8"))
End Sub


When I do send the text received is split. i.e. 1 and then 2345

If I send the whole string as client.print("12345") then the received text is correct


I would be grateful for assistance on why this is happening
( Sorry I had screen shots but don't know how to attach)
 
Top