[zeromq-dev] What prevents reading a message self sent ?
Goswin von Brederlow
goswin-v-b at web.de
Tue Jan 21 12:32:08 CET 2014
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.
> 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
More information about the zeromq-dev
mailing list