Created
June 25, 2011 21:48
-
-
Save saghul/1046936 to your computer and use it in GitHub Desktop.
ZeroMQ producer example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# producer | |
import zmq | |
context = zmq.Context() | |
socket = context.socket(zmq.PUB) | |
socket.setsockopt(zmq.LINGER, 0) # discard unsent messages on close | |
socket.connect('tcp://127.0.0.1:5000') | |
while True: | |
msg = raw_input('> ') | |
if msg == 'quit': | |
break | |
else: | |
socket.send(msg) | |
socket.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment