Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] C++ client crash during connect

Hi Ian,

Thank you for the reply.

The variable http_proxy is not setted in my enviroment variables

Il 09/08/2020 11:52, Ian Craggs ha scritto:

Hi Fausto,

Some thoughts.

1) Do you have an empty http_proxy environment variable? Currently the C client has faulty HTTP proxy code for websockets (which I will fix).

2) If it isn't 1) Try taking a C client trace (see the README for instructions on setting the environment variables) to see what errors there might be.


On 07/08/2020 17:24, Fausto Papandrea wrote:

Hi, I have downloaded the paho-mqtt-c and paho-mqtt-cpp sources from github and I have compiled them.

This is my test code (I got it from the eclipse page):

#include "mqtt/client.h"

int main(int argc, char *argv[])

  const std::string TOPIC { "hello" };
  const std::string PAYLOAD1 { "Hello World!" };
  const char* PAYLOAD2 = "Hi there!";
  mqtt::client client("tcp://localhost:1883", "TestClient");
  mqtt::connect_options connectOptions;
    const mqtt::message_ptr& message = mqtt::make_message(TOPIC, PAYLOAD1);
//    message->set_qos(3);
    client.publish(TOPIC, PAYLOAD2, strlen(PAYLOAD2), 0, false);
  catch (const mqtt::exception& e)
    qDebug() << "Error: " << e.what() << " [" << e.get_reason_code() << "]";
    return 1;
  return 0;

It crashes inside the client.connect(), in particular in file MQTTAsync.c(line 1815) in function MQTTAsync_processCommand() here:

if (command->client->c->connect_state == NOT_IN_PROGRESS)

because command->client->c is null.

Any suggestions? Thank you

paho-dev mailing list
To unsubscribe from this list, visit

paho-dev mailing list
To unsubscribe from this list, visit

Back to the top