I needed to use my Windows 10 Virtual Machine to attend a workshop where labs could only be accessed from Windows operating systems (buh-uh-uh!).
So since I’m back to Windows again, let’s see if
If how I can use MQTT on it.
There are two builds of mosquitto tools for Windows: one that it’s based on cygwin and another ‘native’ built with Microsoft Visual Studio
I started with the second: mosquitto-1.4.15a-install-win32.exe
Please note that I’m using a Windows 10 (x64) virtual machine, not quite full updated and it’s July 2018… things might/will change a bit after a while.
So this is x86 (win32) build but it works on x64. It just needs 3 aditional libraries (dll’s) to work:
The install wizard says that the first and second library can be extracted from the light install of OpenSSL for Windows. But recent versions of OpenSSL no longer use this libraries so I had to download an older one: version 1.0.2o
So I installed this build with the option to include the libraries in the local bin folder where I went to copy “libeay32.dll” and “ssleay32.dll”. Both libraries properties had “file version 22.214.171.124, product version 1.0.2o”.
I copied these 2 files to a new folder “C:\mqtt”
Then I went to POSIC Threads for WIndows project and downloaded the 2.9.1 release and extracted “Pre-built.2\dll\x86\pthreadVC2.dll” also to “C:\mqtt”. File properties had “file version 126.96.36.199, product version 188.8.131.52”.
Then I installed mosquitto 1.4.15a on the same “C:\mqtt” folder, extracting files and configuring the service. This created a Windows Service named “Mosquitto Broker” with a “MQTT v3.1 broker” description, configured as “Automatic” but not started.
From command line, changing to “C:\mqtt” and executing “mosquitto_pub.exe” gives an error stating that another library is missing (MSVCR100.dll). This is from “Microsoft Visual C++ 2010 Redistributable Package” so I installed the x86 version.
Now the same command worked and I could also start the service (“Mosquitto Broker”).
The command line argument are the same as for Linux so
mosquitto_pub.exe -h localhost -m "0" -t sfx -r
works and if I open a second command line window I can see this message arriving:
mosquitto_sub.exe -h localhost -t sfx
Nice. Now I can use LEGO MINDSTORMS, Linux, Raspberry Pi, Android, Arduino and Windows systems on my IoT projects. If someone offers me an Apple OSX device, I’ll be a true polyglIoT ! 😀