Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connect_async error only on Windows #3218

Open
virtuosonic opened this issue Feb 20, 2025 · 0 comments
Open

connect_async error only on Windows #3218

virtuosonic opened this issue Feb 20, 2025 · 0 comments
Labels
Status: Available No one has claimed responsibility for resolving this issue.

Comments

@virtuosonic
Copy link

virtuosonic commented Feb 20, 2025

I have the following mosqpp::mosquittopp class constructor that when reaches the connect_async call returns 8 (MOSQ_ERR_TLS) when running in Windows 11 or 10 but on Ubuntu 24 LTS it works fine.

MqttClient::MqttClient() :
	mosquittopp("myid")
{
	const char* cafile = "ca.crt";
	if(!filesystem::exists(cafile))
		throw runtime_error("ca.crt not found");
	tls_set(cafile);
	tls_opts_set(0);
	const char* mq_user ="machine";
	const char* mq_pwd = "password";
	username_pw_set(mq_user,mq_pwd);
	const char* host = "myserver.com";
	int port = 8883;
	int keepalive = 60;
	auto res = connect_async(host,port,keepalive);
	if(res) qDebug() << "connect_async returned " << res << " " << mosqpp::strerror(res);
	subscribe(nullptr,"+/info/hw");
}

but if I replace connect_async() with connect() it works

I have used mosquitto 2.0.18 on both OS and also 2.0.20 on Windows with the same behavior.

loop_start() is called inside main() after instantiating the class

@github-actions github-actions bot added the Status: Available No one has claimed responsibility for resolving this issue. label Feb 20, 2025
@virtuosonic virtuosonic changed the title connect_async error on only on Windows connect_async error only on Windows Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Available No one has claimed responsibility for resolving this issue.
Projects
None yet
Development

No branches or pull requests

1 participant