KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to use python with zeroMQ in PUSH / PULL mode, sending messages of size 4[MB] every few seconds. For some reason, while it looks like all the messages are sent, ONLY SOME of them appear to have been received by the server. What am I missing here? Here's the code for the client -- client.py import zmq import struct # define a string of size 4[MB] msgToSend = struct.pack('i', 45) * 1000 * 1000 context = zmq.Context() socket = context.socket(zmq.PUSH) socket.connect("tcp://127.0.0.1:5000") # print the message size in bytes print len(msgToSend) socket.send(msgToSend) print "Sent message" And here is the code for the server -- server.py import zmq import struct context = zmq.Context() socket = context.socket(zmq.PULL) socket.bind("tcp://127.0.0.1:5000") while True: # receive the message msg = socket.recv() print "Message Size is: {0} [MB]".format( len(msg) / (1000 * 1000) ) What am I missing? How do I guarantee that messages are always sent and not lost? In case it matters, I am using Ubuntu 10.04 32bit, Core Duo machine with 2[GB] RAM. NOTE: I tried the same example using RabbitMQ and everything works well -- no message is lost. I am perplexed as I often hear praises of zeroMQ . Why did it fail where RabbitMQ succeed?
Tags (comma-separated)
Save Edits
Cancel