Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » MQTT Client for Windows
MQTT Client for Windows [message #1719723] Mon, 11 January 2016 17:19 Go to next message
Mohammad Mayyan is currently offline Mohammad MayyanFriend
Messages: 2
Registered: January 2016
Junior Member
Hi Everyone,

I downloaded the MQTT C client for Windows that found on "https://www.eclipse.org/paho/".

I exactly downloaded "C client for Windows 1.0.3"
The download link is "https://www.eclipse.org/downloads/download.php?file=/paho/1.1/eclipse-paho-mqtt-c-windows-1.0.3.zip"

I have been trying for days to run this library but no sucess. I searched the Internet for any procedure that could help to use this library but I didn't find anything clear and up to date.

So please guys help if anyone can provide a clear procedure to use this library.

Thanks in advance.
Re: MQTT Client for Windows [message #1719828 is a reply to message #1719723] Tue, 12 January 2016 12:05 Go to previous messageGo to next message
Andy Piper is currently offline Andy PiperFriend
Messages: 18
Registered: November 2011
Location: Kingston upon Thames, UK
Junior Member

Are you able to tell us what you've tried so far, what errors you are seeing, and what behaviour you expect?

[Updated on: Tue, 12 January 2016 12:05]

Report message to a moderator

Re: MQTT Client for Windows [message #1719852 is a reply to message #1719828] Tue, 12 January 2016 15:19 Go to previous messageGo to next message
Mohammad Mayyan is currently offline Mohammad MayyanFriend
Messages: 2
Registered: January 2016
Junior Member
Thank you very much for the reply.

I see four folders in the unzipped file and they are bin, include, lib, and samples.

I am actually expecting to have a library that enables me to write a code and generate an executable file. Through this executable file I can set whatever MQTT broker and port and then be able to publish or subscribe.

So, I need a procedure that guides me how to set the visual studio to use those four folders and start writing my own code.

Re: MQTT Client for Windows [message #1725866 is a reply to message #1719852] Tue, 08 March 2016 07:14 Go to previous messageGo to next message
Amey Pandit is currently offline Amey PanditFriend
Messages: 3
Registered: March 2016
Junior Member
Hi

Here is what I did.

Unzip the folder and keep it in the C drive. (Any other drive will work)
I have kept the folder (renamed my folder into a short name) in C drive as C:\paho_mqtt_c_windows\ --> inside this folder, are the include, lib and other folders.

Create a Visual Studio 2013 C++ console project.

Replace the main.cpp code (except the line "#include stdafx.h") with the code given on the page https://eclipse.org/paho/clients/c/.

Then go to project properties. Right click on the project in the Solution Explorer on right side of the window.
Go to configuration properties --> VC++ Directories --> Include Directories-> Add the path of the include folder
E.g. I have added this line C:\paho_mqtt_c_windows\include

Go to configuration properties --> VC++ Directories --> Library Directories-> Add the path of the library folder
E.g. I have added this line C:\paho_mqtt_c_windows\lib

Go to Linker --> Input --> Additional Dependacies -> Edit-. Add following list
paho-mqtt3a.lib
paho-mqtt3as.lib
paho-mqtt3c.lib
paho-mqtt3cs.lib

Say apply and save this project. Close the Visual Studio.

Go to My Computer --> Properties --> Environment Variables --> System Variables --> Path
here add the path of the DLL folder.
For e.g. I have added: ;C:\paho_mqtt_c_windows\lib; (don't miss the semicolons before and after.).

Reopen the Visual Studio project. (sometimes the newly added path in systems variables are not taken immediately).
Compile the project.

This should work. Understand the code and connect to the broker.
I have a Mosquitto MQTT broker running on a Linux machine. You have to give the ip address and the topic (of your choice)
of this broker in the example code given on https://eclipse.org/paho/clients/c/.

Thanks
Amey

Re: MQTT Client for Windows [message #1725885 is a reply to message #1719852] Tue, 08 March 2016 09:45 Go to previous messageGo to next message
Amey Pandit is currently offline Amey PanditFriend
Messages: 3
Registered: March 2016
Junior Member
In addition to my above reply. The page:

www.hivemq.com/blog/mqtt-client-library-pahocclient

gives a very nice explanation on using this library.

Thanks
Amey
Re: MQTT Client for Windows [message #1791014 is a reply to message #1725866] Thu, 21 June 2018 12:18 Go to previous message
Shekhar suthar is currently offline Shekhar sutharFriend
Messages: 1
Registered: June 2018
Junior Member
hello Amey

Thank you so much for helping us I just want to tell you that I'm working in visual studio 2017 om windows 7(64bit) I followed all your step and making the publishing project but my client is not connected and when eve I'm trying to connect getting this
>> " Failed to connect, return code -1 "<< and some time >> " Failed to connect, return code -8 "<<

I tried the same program in codeblocks too but the result is same >> " Failed to connect, return code -1 "<<

I spend lots of time to remove that problem by getting something from varies blogs and articles but getting nothing ...

help me out Thanks
(Shekhar)
Previous Topic:100ms fixed timeout when QoS=2 (bad performances)
Next Topic:Can't get data using subscribe method
Goto Forum:
  


Current Time: Thu Apr 25 10:09:00 GMT 2024

Powered by FUDForum. Page generated in 0.03006 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top