Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
import zmq
import time
# ZeroMQ のバックグラウンド・スレッドのコンテキスト
context = zmq.Context()
# このサーバは、ポート5556で待ちます
socket = context.socket(zmq.PUB)
socket.bind("tcp://*:5556")
i = 0
while True:
i += 1
for ch in range(1,4):
data = ch * i
socket.send_string("{0} {1}".format(ch, data))
print("Ch {0} <- {1} sent".format(ch, data))
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment