Skip to content

Instantly share code, notes, and snippets.

@ixaxaar
Created September 27, 2014 08:50
Show Gist options
  • Save ixaxaar/2dcdc0e6e02e07bc7dd1 to your computer and use it in GitHub Desktop.
Save ixaxaar/2dcdc0e6e02e07bc7dd1 to your computer and use it in GitHub Desktop.
Simple zeromq push server
#!/usr/bin/env python
import time
import zmq
def server():
context = zmq.Context()
socket = context.socket(zmq.PUSH)
socket.setsockopt(zmq.LINGER,0)
socket.connect('tcp://127.0.0.1:8880')
ctr = 0
while 1:
ctr = ctr + 1
if ctr % 10000 == 0: print ctr
socket.send(str(ctr))
# time.sleep(0.00001)
if __name__ == "__main__":
server()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment