Skip to content

Instantly share code, notes, and snippets.

@yishenggudou
Created November 16, 2012 08:35
Show Gist options
  • Save yishenggudou/4085510 to your computer and use it in GitHub Desktop.
Save yishenggudou/4085510 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 timger
# +Author timger
# +Gtalk&Email yishenggudou@gmail.com
# +Msn yishenggudou@msn.cn
# +Weibo @timger http://t.sina.com/zhanghaibo
# +twitter @yishenggudou http://twitter.com/yishenggudou
# Licensed under the MIT License, Version 2.0 (the "License");
import zmq
from time import sleep
def test_sub():
context = zmq.Context()
socket = context.socket(zmq.SUB)
socket.setsockopt(zmq.SUBSCRIBE,'')
socket.connect('tcp://127.0.0.1:50002')
#socket.connect('tcp://127.0.0.1:5555')
while 1:
print socket.recv()
test_sub()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment