Skip to content

Instantly share code, notes, and snippets.

@mkmik
Created July 5, 2012 13:52
Show Gist options
  • Save mkmik/3053787 to your computer and use it in GitHub Desktop.
Save mkmik/3053787 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import zmq
import time
context = zmq.Context()
router = context.socket (zmq.XREP)
router.setsockopt (zmq.IDENTITY, "client")
router.bind("tcp://127.0.0.1:1234")
router.connect("tcp://127.0.0.1:1235")
time.sleep(1)
router.send_multipart(["server", "", "ciao"])
res = router.recv_multipart()
print "GOT RES", res
Assertion failed: ok (xrep.cpp:62)
zsh: abort (core dumped) ./client.py
receiving
Assertion failed: ok (xrep.cpp:62)
zsh: abort (core dumped) ./server.py
#!/usr/bin/env python
import zmq
import time
context = zmq.Context()
router = context.socket (zmq.XREP)
router.setsockopt (zmq.IDENTITY, "server")
router.bind("tcp://127.0.0.1:1235")
# commenting out this line, it works
router.connect("tcp://127.0.0.1:1234")
time.sleep(1)
while True:
print "receiving"
res = router.recv_multipart()
print "GOT", res
print "sending back", res
router.send_multipart(res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment