Coder Social home page Coder Social logo

zmqhb's Introduction

Description

Two applications with command line interface talk to each other using signed zmq messages.

~/zmqhb$ ./server.out
SERVER
Press Enter to send stop instruction

Send:
areYouAlive+1598196459
Received:
{"timestamp":"AliveAt1598196459","statuses":{"subsystem1":"ERROR","subsystem2":"OK"}}

Send:
areYouAlive+1598196460
Received:
{"timestamp":"AliveAt1598196460","statuses":{"subsystem1":"OFF","subsystem2":"WARNING"}}
~/zmqhb$ ./client.out
CLIENT

Received:
areYouAlive+1598196459
Send:
{"timestamp":"AliveAt1598196459","statuses":{"subsystem1":"ERROR","subsystem2":"OK"}}

Received:
areYouAlive+1598196460
Send:
{"timestamp":"AliveAt1598196460","statuses":{"subsystem1":"OFF","subsystem2":"WARNING"}}

Requirements

#install ccpzmq
echo 'deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/xUbuntu_18.04/ /' | sudo tee /etc/apt/sources.list.d/network:messaging:zeromq:release-stable.list
curl -fsSL https://download.opensuse.org/repositories/network:messaging:zeromq:release-stable/xUbuntu_18.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/network:messaging:zeromq:release-stable.gpg > /dev/null
sudo apt update
sudo apt install libzmq3-dev=4.3.2

#install the rest
sudo apt install g++
sudo apt-get install libboost-all-dev
sudo apt-get install cmake
sudo apt-get install libssl-dev

Make

cmake .
cmake --build .

Use

Run client in terminal:

./client.out

Run server in the other terminal:

./server.out

You should see client-server communication log in the terminal. Press Enter in server command line to send stop instruction to client.

The aplications read corresponsing keys from the source directory.

Run in docker containers

Build image:

sudo docker build .

Run client terminal:

sudo docker-compose up client

Run server in the other terminal:

sudo docker-compose up server

You should see client-server communication log in the terminal. Press Enter in server command line to send stop instruction to client.

Generating Keys

openssl ecparam -name prime256v1 -genkey -noout -out private.ec.key
openssl ec -in private.ec.key -pubout -out public.pem

zmqhb's People

Contributors

mikhailkazagashev avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.