[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Client Publications rejected / QoS error

Hi everyone,

I'm trying to implement a MQTT-client based on the embedded variant of Paho. This is what my code looks like (pseudocode of the relevant parts):

 Âstruct mqtt_inst_data Â*instData;
 ÂMQTTPacket_connectData Âdata="">
 ÂMQTTString       Âtopic=MQTTString_initializer;

 Â-> open TCP/IP connection here

 Âdata.clientID.cstring=id;#else
 Âdata.cleansession=1;
 Âlen = MQTTSerialize_connect(buf,MAX_BUFLEN,&data); /* 1 */

 Âtopic.cstring=(char*)topicData->c_str();

 Âstrncpy(payload,payData->c_str(),200);
 Âpayloadlen=strlen(payload);

 Âlen+=MQTTSerialize_publish(buf+len,MAX_BUFLEN-len,0,3,0,0,topic,(unsigned char*)payload,payloadlen); /* 2 */
 Âlen+=MQTTSerialize_disconnect(buf+len,MAX_BUFLEN-len); /* 3 */

 Â-> send data "buf" with length "len" here
 Â-> close TCP/IP connection

After doing this Mosquitto debug output comes with following error messages:

1538382438: New connection from 192.168.188.1 on port 1883.
1538382446: New client connected from 192.168.188.1 as C85B76DF5FF6 (c1, k60).
1538382446: No will message specified.
1538382446: Sending CONNACK to C85B76DF5FF6 (0, 0)
1538382446: Invalid QoS in PUBLISH from C85B76DF5FF6, disconnecting.
1538382446: Socket error on client C85B76DF5FF6, disconnecting.

Where/how do I have to set this QoS stuff exactly?ÂMQTTPacket_connectData has a sub-structureÂMQTTPacket_willOptions which itself contains a member "qos" - but what do I have to do with this structure exactly? Or is this error caused by some other problem?

Thanks!

Mike