LoginSignup
4
3

More than 5 years have passed since last update.

Windows Server 2012 64bitにMQTT(Mosquitto)を入れるメモ

Posted at

下記ページを参考にWS2012にMosquittoを入れたところでハマったポイント

Windows 7 64bitにMQTT(Mosquitto)を入れるメモ

パスは変えなくても大丈夫

C:\Program Files (x86)\mosquittoではなく C:\mosquitto にします。

DLLを入れる必要があるので~と記述ありますが、どうせDLLを直接コピーするのでインストールパスは変えても変えなくても問題ありません。

pthreadsはx86の方を使う!!

1 Pre-built.2\dll\x64\pthreadVC2.dll
にあるようです。pthreadVC2.dllをMosquittoフォルダに入れます。

とあるのでx64が正解かと思いきや、後述するpub/sub.exeを動かすためにはx86が正解のようです。
なのでこちら↓をコピーして使いましょう。

~\pthreads-w32-2-9-1-release\Pre-built.2\dll\x86\pthreadVC2.dll

Serviceとして動かすには?

参考ページではcmdから起動させる様子が見られますが、当然Serviceとしても起動可能です。
管理ツール>サービス>Mosquitto Broker
から開始しましょう。

Pub/Sub.exeの使い方

以下の流れで動作確認できるかと!

0.Brokerを立ち上げる(cmdからでもServiceでもOK)
 mosquitto.exe -v ←cmdから立ち上げる例
1.Subscriverを立ち上げる(cmd1)
 mosquitto_sub.exe -h localhost -t "#" -v
2.Puslisherを立ち上げる(cmd2)
 mosquitto_pub.exe -h localhost -t "test" -m "Hello, World."

これで1の窓にtest Hello. World.と表示されると思います。
ついでにBrokerをcmdで立ち上げているなら通信の様子とかも垣間見れるはず。
細かいパラメータは--helpで確認できるので眺めてみてください。

それでは、よきMosquitto Lifeを!

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3