Skip to content

azmisaquib/zmq-pubsub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZMQ Pub-Sub

This is a simple project that shows how to use ZeroMQ's Pub-Sub to communicate between two programs. The publish.cpp file opens and binds to the pub port and sends out 100 messages. The subscribe.cpp file subscribes to the port and prints out messages that it receives.

ZMQ C++.

Bootstrap

Bootstrap script to install ZeroMQ is included for Ubuntu 18.

Building the Program

Cmake has been included so you can build the project simply:

❯ rm -rf build && mkdir build
❯ cd build
❯ cmake ..
❯ make

Running the Program

After building the program, it will create the publish and subscribe binaries in the build directory.

Firstly, in one terminal window run the subscribe program:

❯ sudo ./subscribe

Then, in another terminal window run the publish program:

❯ sudo ./publish