Help Needed: Handling Serialized Data with Escaped Characters in Paho MQTT/Packet Library
I need a little help. @Middleware & OS I'm using the library called
paho mqtt/packet
. The example provided with it performs serialization of the data that needs to be sent and then sends it over TCP just like that. I have written the code for the ESP, and it works fine without any issues. However, when I serialize the data, it looks like this (as seen in the debugger):
The driver I wrote treats these escapes as the end of the string, so it doesn't see anything and doesn't send anything. Is this format normal? I mean, is the packet supposed to look like this? And if this is the normal format, how can I deal with these escapes?
Here's the code and the shape of the array before sending:Solution:Jump to solution
you are right, I hadn't initialized it. I have added
memset(buf, 0, 200);
to my code, but I'm still facing the same issue with the serialized data being interpreted incorrectly ...3 Replies
There is no initialisation of your buf variable try memset( buf, 0, 200 );
👍
Solution
you are right, I hadn't initialized it. I have added
memset(buf, 0, 200);
to my code, but I'm still facing the same issue with the serialized data being interpreted incorrectly ...