[zeromq-dev] Multithreaded server, delivers message in one direction
tlrx
tlrx.dev at gmail.com
Tue Oct 25 10:20:50 CEST 2011
I've read the doc, which is clear and confirms my previous understanding,
but I still have the problem.
I think I am missing something... Here's my Java code for the XREP:
public void run() {
ZMQ.Socket socket = context.socket(ZMQ.REP);
socket.connect("inproc://workers");
while (true) {
List<byte[]> parts = new ArrayList<byte[]>();
do {
byte[] request = socket.recv(0);
parts.add(request);
}while (socket.hasReceiveMore());
// Send back all the socket identities
for(int i=0; i<(parts.size() - 1); i++){
socket.send(parts.get(i), ZMQ.SNDMORE);
}
// Do I need to send a <null part message> here?
// Send the reply message
String reply = "See you " + this.toString();
socket.send(reply.getBytes(), 0);
}
}
Does the lib automatically send the <null message part> if I use
socket.send(.., 0)?
I tried to send an empty by array or null before the reply message, but it
does not solve my problem.
Thanks for your help.
Tanguy
Le 24 octobre 2011 17:54, Chuck Remes <cremes.devlist at mac.com> a écrit :
>
> On Oct 24, 2011, at 10:51 AM, tlrx wrote:
>
> > Thanks for your answer Pieter.
> >
> > I thought the Router, Dealer and Queue were in charge of managing (with
> enveloppe) a valid ID frame that identifies the original client.
> >
> > The worker retrieves a multipart message, and sent it back (it only
> modifies the last part - containing the original message). Am I wrong or
> something?
> >
> >
> > How can I debug/see the incoming ID frame and the outgoing one?
>
> These pages on the wiki might be helpful.
>
> http://www.zeromq.org/tutorials:xreq-and-xrep
>
> http://www.zeromq.org/sandbox:dealer
>
> If you have specific questions after reading through these documents, let
> us know. Since it is a wiki, you could also modify those pages to clarify
> issues that are unclear in your opinion.
>
> cr
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20111025/d9b59edb/attachment.htm>
More information about the zeromq-dev
mailing list