[zeromq-dev] inproc connect before bind req rep

Pieter Hintjens ph at imatix.com
Thu Aug 14 13:51:34 CEST 2014


This functionality was added after the 4.0 release, and is part of the
4.1 version.

2014-08-14 11:36 GMT+02:00 Palfinger Werner <Werner.Palfinger at profactor.at>:
> I just noticed, that it works with the trunk version of zmq. But with 4.0.4 it fails. Here is the test:
>
> void test_connect_before_bind_req_rep()
> {
>        void *ctx = zmq_ctx_new();
>         assert(ctx);
>
>         // Connect first
>         void *connectSocket = zmq_socket(ctx, ZMQ_REQ);
>         assert(connectSocket);
>         int rc = zmq_connect(connectSocket, "inproc://cbbr");
>         assert(rc == 0);
>
>         // Queue up some data
>         rc = zmq_send_const(connectSocket, "foobar", 6, 0);
>         assert(rc == 6);
>
>         // Now bind
>         void *bindSocket = zmq_socket(ctx, ZMQ_REP);
>         assert(bindSocket);
>         rc = zmq_bind(bindSocket, "inproc://cbbr");
>         assert(rc == 0);
>
>         // Read pending message
>         zmq_msg_t msg;
>         rc = zmq_msg_init(&msg);
>         assert(rc == 0);
>         rc = zmq_msg_recv(&msg, bindSocket, 0); // <--------- Hangs here
>         assert(rc == 6);
>         void *data = zmq_msg_data(&msg);
>         assert(memcmp("foobar", data, 6) == 0);
>
>         // Cleanup
>         rc = zmq_close(connectSocket);
>         assert(rc == 0);
>
>         rc = zmq_close(bindSocket);
>         assert(rc == 0);
>
>         rc = zmq_ctx_term(ctx);
>         assert(rc == 0);
> }
>
>>Connect before bind should not depend on the socket type. And REQ
>>sockets should definitely not silently drop messages. Do you have a
>>minimal test case?
>>
>>On Mon, Aug 11, 2014 at 4:17 PM, Werner Palfinger
>><werner.palfinger at profactor.at> wrote:
>>> Hi,
>>> in libzmq/tests/test_inproc_connect.cpp there are connect-before-bind-tests
>>> for PAIR-PAIR and PUB-SUB but not for REQ-REP. It seems that this is still
>>> not working. I tested it and the REQ-socket connected but silently dropped
>>> the message. Are there any plans to fix that?
>>> - Werner
>>>
>>> _______________________________________________
>>> zeromq-dev mailing list
>>> zeromq-dev at lists.zeromq.org
>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
> Dieses E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der vorgesehene Adressat sind, so bitten wir Sie, uns unverzüglich zu informieren und die Nachricht zu löschen. Nach dem Telekommunikationsgesetz sind Sie verpflichtet, den Inhalt der Nachricht sowie die Tatsache ihres Empfanges weder aufzuzeichnen, noch Unbefugten mitzuteilen oder für irgendwelche Zwecke zu verwerten, sondern diese zu löschen.
>
> Der Austausch von Nachrichten via E-Mail dient ausschließlich Informationszwecken. Jegliche rechtsgeschäftliche Erklärungen der PROFACTOR GmbH bedürfen zu ihrer Rechtswirksamkeit der schriftlichen, firmenmäßigen Bestätigung.
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev



More information about the zeromq-dev mailing list