https://learning-0mq-with-pyzmq.readthedocs.io/en/latest/pyzmq/patterns/client_server.html
#sudo apt-get install libzmq3 libzmq3-dev python3-zmq
#vim pairserver.py
import zmq
import random
import sys
import time
port = "5556"
context = zmq.Context()
socket = context.socket(zmq.PAIR)
socket.connect("tcp://localhost:%s" % port)
while True:
msg = socket.recv()
print(msg)
socket.send("client message to server1".encode('ascii'))
socket.send("client message to server2".encode('ascii'))
time.sleep(1) #vim pairclient.py import zmq
import random
import sys
import time
port = "5556"
context = zmq.Context()
socket = context.socket(zmq.PAIR)
socket.bind("tcp://*:%s" % port)
while True:
socket.send("Server message to client3".encode('ascii'))
msg = socket.recv()
print(msg)
time.sleep(1)
#python3 pairserver.py 1100 #python3 pairclient.py 1101