Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import time
- import zmq
- def main():
- host = "tcp://127.0.0.1:5554"
- ctx = zmq.Context()
- sock = ctx.socket(zmq.PAIR)
- sock.connect(host)
- try:
- sock.send("hello")
- while True:
- msg = sock.recv()
- print msg
- sock.send("client message to server1")
- sock.send("client message to server2")
- time.sleep(1)
- except:
- pass
- finally:
- sock.close()
- ctx.term()
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment