Created
July 5, 2012 13:52
-
-
Save mkmik/3053787 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/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 |
This file contains hidden or 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
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 |
This file contains hidden or 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
#!/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