--- libaitmqtt/example/cmds.c 2012/06/20 15:02:23 1.2 +++ libaitmqtt/example/cmds.c 2012/06/21 13:47:29 1.2.2.1 @@ -51,7 +51,8 @@ main() if (!(len = mqtt_readPUBLISH(m, topic, sizeof topic, &msgID, (void**) &pub))) { printf("Error:: mqtt_readPUBLISH() #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); return 2; - } + } else + hdr = (struct mqtthdr*) m->msg_base; printf("read publish: dup=%d qos=%d retain=%d\n", hdr->mqtt_msg.dup, hdr->mqtt_msg.qos, hdr->mqtt_msg.retain); printf("++> topic=%s MessageID=%d DATA=(%d)%s\n", topic, msgID, len, pub); free(pub);