Thanks Chuck and Lourens for your very speedy reply!
I have two threads and to overcome this problem I have set-up the code like
this:
Thread A is guaranteed to execute the relevant parts of the code first even
before Thread B gets started.
Thread A
----------
.
.
socket1.bind("inproc://addr1");
socket1.blockingrecv();
socket2.connect("inproc://addr2");
.
.
Thread B
----------
.
.
.
socket3.bind("inproc://addr2");
socket4.connect("inproc://addr1");
socket.send(msg);
.
.
.
Is this guaranteed to work?
My question is this: after socket3.bind() is done and right before
socket4.connect() is executed, is socket3 guaranteed to be ready for connection?
Thanks!
KC
________________________________
From: Chuck Remes <[email protected]>
To: Kah-Chan Low <[email protected]>; ZeroMQ development list
<[email protected]>
Sent: Thursday, October 18, 2012 12:57 PM
Subject: Re: [zeromq-dev] inproc: need to bind to an address before connect?
It's a long-standing bug that is very difficult to fix. The work around is to
do as you discovered which is *always bind first* and then connect when using
inproc transport.
For details as to why this is hard, try searching the mailing list archive. The
answer would have been given by Martin Sustrik. You can also check the bug
database for a write-up on this.
cr
On Oct 18, 2012, at 11:55 AM, Kah-Chan Low wrote:
Hi,
>When I do this I will get a "connection refused" error:
>
>
>socket1.connect("inproc://abc");
>socket2.bind("inproc://abc");
>
>
>When I reverse the order of the statements everything works fine.
>Both sockets have been created with the same ZMQ context.
>
>
>Is this a feature or a bug?
>
>
>Thanks!
>KC
>
>
>
>_______________________________________________
>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