mosquitto C program not working with qos 0

Bug #1495379 reported by Kewal
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mosquitto (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

I am using apollo broker, and mosquitto v 3.1 C client library to interact with the broker. I am using a basic program to test the client and the broker. While the program works nicely with qos 1, it does not work with qos 0 and I cannot find the reason why it is not working with qos 0. I am using a ubuntu 14.04LTS. Ill add the code that I am using below. Please help me

#include<stdio.h>
#include<stdlib.h>
#include<mosquitto.h>

void on_publish(struct mosquitto *mosq, void *userdata, int mid)
{
 printf("Inside publish callback");
        mosquitto_disconnect(mosq);
}

int main(int argc, char *argv[])
{
    struct mosquitto *mosq;
    int err;
    int err1;

    mosq = mosquitto_new("unknown", true, NULL);
    mosquitto_publish_callback_set(mosq, on_publish);

    mosquitto_username_pw_set(mosq,"admin","password");
    err=mosquitto_connect(mosq, "localhost", 61613,60);

 if(err != 0 ){
     printf("connect error= %s\n",mosquitto_strerror(err));
     printf("error : %d\n",err1);
     exit(0);
 }

    err1 = mosquitto_publish(mosq, NULL, "subject", 11, "Works", 0, true);

 printf("Publish error = %s\n",mosquitto_strerror(err1));

    mosquitto_loop_forever(mosq, -1, 1);
    return 0;
}

Kewal (premsinghania326)
description: updated
Revision history for this message
Roger Light (roger.light) wrote :

I'm not quite sure how it went so long without this report being spotted, sorry about that. Are you still having problems? At the moment there isn't enough information to go on so I will close it as "incomplete" at some point in the future unless you can give more details.

Changed in mosquitto (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for mosquitto (Ubuntu) because there has been no activity for 60 days.]

Changed in mosquitto (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.