Le 21/01/2014 12:32, Goswin von Brederlow a écrit :
On Tue, Jan 21, 2014 at 11:09:54AM +0100, Laurent Alebarde wrote:
Hi Devs,
This is my thuesday morning stupid question: say I have a socket on
which I send a message, and just after I put a receive on this same
socket in the code. What prevents in libzmq to receive the message I
have just sent ?
Let's raise the question differently, what prevents zmq_proxy to
loop indefinitely since what it receives on socket A, it sends it on
socket B, and vice versa ?
socket A socket B
| ______________________\______________________ |
|/ / \|
| |
|\______________________/______________________/|
| \ |
zmq_proxy(A,B)does not loop on itself like this
Why does it manage to work like this:
socket A socket B
| |
-->|---------------------------------------------->|------------>
| |
| |
<--|<----------------------------------------------|<------------
zmq_proxy(A,B)does what it is expected to do, yeah !
I imagine it is more like:
socket A socket B
| |
-->| recv() -> send() |------------>
| |
| |
<--| send() <- recv() |<------------
Each socket has an incoming and outgoing queue. Recv() looks in the
incoming queue and send() puts messages in the ougoing queue and never
the two shall meet.
It was so simple ! Shame on me :-[ . Thank you Goswin.
Can I chain: zmq_proxy(A,B); zmq_proxy(B,C), zmq_proxy(C,D),
assuming I start them in different threads ?
I don't see why not.
Cheers,
Laurent
MfG
Goswin
_______________________________________________
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