Anything over 600 bytes malforms the packet and it cannot be published. MQTTSerialize_publish (library) returns the correct amount of bytes for the payload however (eg. 1260).
I can't see any apparent limit in the code or the MQTT standard.
This is how i call the function
unsigned char bufm[1500];
int bufmlen = sizeof(bufm);
rc = MQTTSerialize_publish(bufm, sizeof(bufm), dup, qos, retained, msgid, topicString[0], message, messageLen);
I get this in my console for a particular payload:
messageLen=580
sizeof bufm=1500
rc=600
The payload (bufm) is transmitted fine.
For a different payload:
messageLen=638
sizeof bufm=1500
rc=658
And since the payload is larger than 600 bytes the payload (bufm) is now only 19 bytes and only contains some parts of the message array. Notice how the rc is correct on both occasions.
Also there is enough memory where my pointer points to unsigned char bufm[1500];
---------------------------------EDIT---------------------------------
yup..... It was a stack issue. My pointer was pointing to the stack...so stack overflow
Sorry and thanks for the help.
thanks
yup..... It was a stack issue. My pointer was pointing to the stack...so stack overflow
Sorry and thanks for the help.