Comments (9)
I finally found something that could do this... The GNU Makefile in the samples directory was linking the ssl_publish sample to the non-SSL version of the Paho C library. I just pushed the fix for that to the 'develop' branch.
Please make sure that you're linking to the Paho C library paho-mqtt3as
(with the 's' at the end).
I tested this against the certificates in the Paho C test directory. I ran mosquitto with the configuration from there:
git clone https://github.com/eclipse/paho.mqtt.c.git
cd paho.mqtt.c
mosquitto -c test/tls-testing/mosquitto.conf
And then I used the file "test-root-ca.crt" from that directory (paho.mqq.c/test/tls-testing) as the trust store for ssl_publish. That all worked for me.
Other than that, the C++ library just passes the names of the SSL/TLS certificates down to the C library. If there are still issues, perhaps we can get help from the folks working directly with the C library.
from paho.mqtt.cpp.
Thank you very much for the suggestions!
I will try it immediately and then I will inform you if this work.
from paho.mqtt.cpp.
OK,
thank you again,
I have tested ssl_publish on an ubuntu machine and,, following your iindications, it works properly,
But I have stll the same problem indicated in my first post, running it in my raspberry (with the same configuration and certificates).
Some other hints:
- sync_publisher works also on the raspberry, it iconnects itself to the mosquitto correctly.
- I have started mosquitto in verbose mode and when I start the ssl_publish client, it doesn't print on console (it is not a TLS handshake problem). It doesn't receive the connection.
Please, let me know if you have some other suggestion,
from paho.mqtt.cpp.
So, if I understand... It works over localhost on either an Ubuntu PC or a Raspberry Pi, but if you try to connect a client on the Pi to the mosquitto broker on a PC, it doesn't work?
Does it work with another client across this connection? (Java client or maybe mosquitto utility like mosquitto_pub)? Could there be a firewall getting in the way? Or the server configured for only localhost?
I have a few hundred RPi's at my office, so I can try this as well. But I won't be there for a few days.
from paho.mqtt.cpp.
No sorry I have not been clear,
I have installed the paho.mqtt library and the mosquitto server both on the ubuntu PC and on the raspberry Pi, and for both, I have tested the localhost connection, running mosquitto using the same configuration that you have indicated: test/tls-testing/mosquitto.conf.
If I run ssl_publish on the Ubuntu PC, the connection to the local mosquitto works.
if I run ssl_publish on the Raspberry Pi, the connection to the local msquitto doesn't work.
I hope to have been more clear now,
from paho.mqtt.cpp.
Oh. OK. I've got it now. I will test that as soon as I can.
from paho.mqtt.cpp.
I tested on a RaspberryPi, and it worked as expected. I did not see a problem.
I'm using Raspbian Jessie on an RPi2, and I did a full apt-get update/upgrade before starting the tests. This also updated my version of mosquitto:
$ uname -a
Linux thrivepi 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux
$ mosquitto -h
mosquitto version 1.4.11 (build date Mon, 20 Feb 2017 22:47:27 +0000)
...
I tested with the latest development version of both Paho C & C++ (the 'develop' branches of each, as of this morning) and did a native build of both using GCC v 4.9.2.
The sample showed the usual output:
$ ./ssl_publish
Initializing for server 'ssl://localhost:18885'...
...OK
Connecting...
Waiting for the connection...
...OK
Sending message...
Delivery complete for token: ...OK
Sending next message...
1
Delivery complete for token: 2
...OK
Disconnecting...
...OK
and mosquitto (running with the verbose '-v' option) showed:
1492447514: New connection from 127.0.0.1 on port 18885.
1492447514: New client connected from 127.0.0.1 as CppAsyncPublisherSSL (c1, k60, u'testuser').
1492447514: Sending CONNACK to CppAsyncPublisherSSL (0, 0)
1492447514: Received PUBLISH from CppAsyncPublisherSSL (d0, q1, r0, m1, 'hello', ... (0 bytes))
1492447514: Sending PUBACK to CppAsyncPublisherSSL (Mid: 1)
1492447514: Received PUBLISH from CppAsyncPublisherSSL (d0, q1, r0, m2, 'hello', ... (0 bytes))
1492447514: Sending PUBACK to CppAsyncPublisherSSL (Mid: 2)
1492447514: Received DISCONNECT from CppAsyncPublisherSSL
1492447514: Client CppAsyncPublisherSSL disconnected.
from paho.mqtt.cpp.
OK, thank you very much for the test,
in my tests I have used the master version of paho-mqtt-c and not the develop branch. I will try with that branch and then I will let you know the result.
from paho.mqtt.cpp.
This seems to be working now.
from paho.mqtt.cpp.
Related Issues (20)
- Cross compilation of paho.mqtt.cpp HOT 9
- cmake issue in Docker container HOT 2
- error in install_paho_mqtt_c.sh in the installation process of the latest version of paho.mqtt.cpp HOT 1
- ThreadSanitizer: lock-order-inversion (potential deadlock) paho 1.2.0
- Linker-Error when compiling with v1.3.2 HOT 5
- connect_options_builder doesn't propagate always properties HOT 5
- Rustls C++ binding into the paho-mqtt HOT 1
- Build error in Xcode project HOT 2
- Paho C library can be built along with the C++ library in a single step? HOT 4
- Build errors in Visual Studio 2022 HOT 4
- build cpp on windows x64 vs2019
- CMake error while compiling paho.mqtt.cpp HOT 4
- MQTT traffic over Https Proxy HOT 1
- MQTTAsync_send cpu load increases a lot while buffering messages HOT 2
- Subscribe to broker creates a random queue HOT 2
- Arm cross compile fails on version 1.3.x - disconnect options HOT 1
- SESSION_EXPIRY_INTERVAL is int, not uint HOT 6
- token->wait() hangs when publishing from 2 threads HOT 3
- Build error on Windows 11 - Visual Studio community 2022 - Cmake 3.29.6 HOT 7
- Can not run subscription!Info:0x00007FFB16EFCF19 处(位于 mqtt_install_test_vs.exe 中)有未经处理的异常: Microsoft C++ 异常: std::bad_alloc,位于内存位置 0x000000B68D9AE370 处。 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paho.mqtt.cpp.