Thank you very much. From: Joshua Foster Sent: Thursday, September 22, 2011 6:55 PM To: ZeroMQ development list Subject: Re: [zeromq-dev] What ZMQ will do when I use the multipart message
Yes, my examples were in Java. Joshua On Sep 21, 2011, at 11:22 PM, jjmilk13 wrote: As your words I can do the same work in java? Does the code is similarity? From: Joshua Foster Sent: Thursday, September 22, 2011 11:15 AM To: ZeroMQ development list Subject: Re: [zeromq-dev] What ZMQ will do when I use the multipart message A multipart message is just a message of many parts. You create a multipart message by sending with the ZMQ.SNDMORE flag like this: socket.send(myfirstbytes, ZMQ.SNDMORE); socket.send(mysecondbytes, 0); That would create a 2 part message. Its usually helpful for adding flags for context switching (knowing what type of message is sent). You can see this in some of the protocols like the paranoid pirate protocol (http://rfc.zeromq.org/spec:6). ZeroMQ looks at the multipart message atomically so it either all arrives or it doesn't at all. The other implication is that you can't "stream" parts of a message. It all needs to fit in memory. You can determine if you have more parts to a message by using the socket.hasRecvMore() method like this: data = socket.recv(0); while (socket.hasRecvMore()) { moredata = sockect.recv(0); // do something with moredata... } // no more parts to the message anymore Joshua On 9/21/2011 9:55 PM, jjmilk13 wrote: Hi all I’m using ZMQ in java. And now I’m confusing about what ZMQ will do when I use the multipart message. Does it cut the messages piece by piece automatically? What if id does, I still don’t know how big is piece it been cut into? And what if id does not, how can I deal with it? Thanks jinjing wu _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev ------------------------------------------------------------------------------ _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev -------------------------------------------------------------------------------- _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
