Skip to content

Problem with reconnect() in MQTT Paho C++ when Connecting to TLS Server #551

@zhaohang666

Description

@zhaohang666

I'm using the MQTT Paho C++ library in my project. Here's the situation:
1.I use the token_ptr async_client::connect(connect_options opts, void* userContext, iaction_listener& cb) function to connect to a TLS - enabled MQTT server, and the connection is successful.
2.Then, I use the token_ptr async_client::disconnect(int timeout, void* userContext, iaction_listener& cb) function to disconnect from the server.
3.After that, when I try to use the token_ptr async_client::reconnect() function to reconnect, it fails with the error message "10.04.25 14:40:42.258 root ERROR - MQTT exception occurred in reconnect: Code=0, Message=Failure".
However, if I use the token_ptr async_client::connect(connect_options opts, void* userContext, iaction_listener& cb) function again, I can establish the connection successfully. Also, when I don't use TLS encryption, the token_ptr async_client::reconnect() function works fine after disconnection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions