[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Publish does not appear in Broker


I'm using the embedded C/C++ variant of the PAHO-project out of a microcontroller. My Problem: although the data are sent (can be verified with WireShark), a broker these data sent to does not recognise them and does not show the related data. This was testedwith HiveMQ and BevyWise MQTTRoute.

This is what I'm doing to create and send a message (pseudo-code due to some microcontroller-specific function calls):

 ÂMQTTSNPacket_connectData data="">
 Âint           rc=0,payloadlen,len;
 Âunsigned char      buf[MAX_BUFLEN+1];
 ÂMQTTSN_topicid     Âtopic;
 Âchar          Âpayload[200+1];
 Âchar          Âid[200+1];

--> open a TCP/IP conection to the broker here

 Âdata.clientID.cstring=(char*)m_machineID->c_str(); // get identifier from std::string
 Âlen = MQTTSNSerialize_connect(buf,MAX_BUFLEN,&data);

 Âtopic.data.long_.name=(char*)topicData->c_str(); // get the topic data
 Âstrncpy(payload,payData->c_str(),200); // get the data to be sent

 Âlen+=MQTTSNSerialize_publish(buf+len,MAX_BUFLEN-len,0,3,0,0,topic,(unsigned char*)payload,payloadlen);
 Â// here the fourth parameter has to be "3", when setting it to "0", the topic does not become part
 Â// of the data in "buf"


--> send the data in "buf" with the length "len" here - this is successful
--> close the TCP/IP connection to the broker here

Any idea what I'm doing wrong here?