|Re: [paho-dev] MQTT-SN DISCONNECT message's Duration is optional.|
the MQTT-SN specification says (5.4.21):
"Duration: contains the value of the sleep timer; this field is optional and is included by a “sleeping” client that wants to go the “asleep” state, see Section 6.14 for further details."
"As with MQTT, the DISCONNECT message is sent by a client to indicate that it wants to close the connection. The gateway will acknowledge the receipt of that message by returning a DISCONNECT to the client. A server or gateway may also sends a DISCONNECT to a client, e.g. in case a gateway, due to an error, cannot map a received message to a client. Upon receiving such a DISCONNECT message, a client should try to setup the connection again by sending a CONNECT message to the gateway or server. In all these cases the DISCONNECT message does not contain the Duration field.
A DISCONNECT message with a Duration field is sent by a client when it wants to go to the “asleep” state. The receipt of this message is also acknowledged by the gateway by means of a DISCONNECT message (without a duration field)."
Does that answer your question?
The gateway does not have to support all functions to start with, or even to end with. If you wanted to submit a work in progress for others to try out, test and review then that might be a good approach.
On 04/21/2016 10:33 AM, Tomoaki Yamaguchi wrote:
Tomoakiwhat is the meaning of optional ?Hi All,in MQTTSNPacket.c
int MQTTSNSerialize_disconnect(unsigned char* buf, int buflen, int duration)
ptr += MQTTSNPacket_encode(ptr, len); /* write length */
writeChar(&ptr, MQTTSN_DISCONNECT); /* write message type */
if (duration >= 0) <======
if (duration >= 0) should be if (duration > 0) .
_______________________________________________ paho-dev mailing list paho-dev@xxxxxxxxxxx To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/paho-dev
-- Ian Craggs icraggs@xxxxxxxxxx IBM United Kingdom Paho Project Lead; Committer on Mosquitto
paho-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
Back to the top