[zeromq-dev] Poll on pair socket

Pieter Hintjens pieterh at gmail.com
Sat Nov 10 16:23:44 CET 2012


Ah, interesting.... I suggest you ping Martin Hurton and/or Min, if you
don't find it.

Good luck, the .net port is an awesome project.

Pieter
On Nov 11, 2012 12:01 AM, "Doron Somech" <somdoron at gmail.com> wrote:

> The actual problem is that it is not working on the .net port, i'm trying
> to understand why (zmq_poll on pair).
>
> The actual polling is on the signaler of the mailbox, right? because the
> mailbox signaler is never signaled (except on the connect).
>
> I'm debugging both the .net port and libzmq to try and find the bug.
>
> if you have any directions that will help...
>
> On Sat, Nov 10, 2012 at 4:47 PM, Pieter Hintjens <ph at imatix.com> wrote:
>
>> No problem. For what it's worth, copying/pasting code from the Guide
>> examples will reduce this kind of error.
>>
>> -Pieter
>>
>> On Sat, Nov 10, 2012 at 11:39 PM, Doron Somech <somdoron at gmail.com>
>> wrote:
>> > thanks, it is working now.
>> >
>> >
>> > On Sat, Nov 10, 2012 at 4:34 PM, Pieter Hintjens <ph at imatix.com> wrote:
>> >>
>> >> Use ZMQ_POLLIN instead of POLLIN and it will work.
>> >>
>> >> -Pieter
>> >>
>> >> On Sat, Nov 10, 2012 at 11:14 PM, Doron Somech <somdoron at gmail.com>
>> wrote:
>> >> > I may get it wrong, but this is the code i'm using the poll is
>> blocked
>> >> > forever:
>> >> >
>> >> > int main (int argc, char *argv [])
>> >> > {
>> >> > void* ctx = zmq_ctx_new();
>> >> >
>> >> > void *p1 = zmq_socket(ctx, ZMQ_PAIR);
>> >> > void *p2 = zmq_socket(ctx, ZMQ_PAIR);
>> >> >
>> >> > zmq_bind(p1, "inproc://d.inproc");
>> >> > zmq_connect(p2, "inproc://d.inproc");
>> >> >
>> >> > char arr[1];
>> >> > arr[0] = 1;
>> >> >
>> >> > zmq_send(p1, arr, 1, 0);
>> >> >
>> >> > zmq_pollitem_t item;
>> >> > item.socket = p2;
>> >> > item.events = POLLIN;
>> >> >
>> >> > int result = zmq_poll(&item, 1, -1);
>> >> >
>> >> > return 0;
>> >> > }
>> >> >
>> >> > On Sat, Nov 10, 2012 at 4:07 PM, Pieter Hintjens <ph at imatix.com>
>> wrote:
>> >> >>
>> >> >> Poll on PAIR sockets definitely works, we use this all the time.
>> >> >>
>> >> >> Can you make a minimal test case that shows the problem happening?
>> It
>> >> >> could be that you've simply made an error in how you're calling
>> >> >> zmq_poll.
>> >> >>
>> >> >> -Pieter
>> >> >>
>> >> >>
>> >> >> On Sat, Nov 10, 2012 at 9:43 PM, Doron Somech <somdoron at gmail.com>
>> >> >> wrote:
>> >> >> > Hi,
>> >> >> >
>> >> >> > I'm trying to build a reactor which will also listen to the
>> monitor
>> >> >> > socket.
>> >> >> > the problem is that poll on a pair socket is not working.
>> >> >> >
>> >> >> > checking the code i found out that the send_activate_read is never
>> >> >> > called on
>> >> >> > a pair socket (which is causing the signaling on the socket the
>> poll
>> >> >> > is
>> >> >> > actually listen on).
>> >> >> >
>> >> >> > I don't want to create a thread for each socket i'm going to
>> monitor,
>> >> >> > other
>> >> >> > alternative is to configure the socket with receive timeout of
>> zero
>> >> >> > and
>> >> >> > use
>> >> >> > don't wait option.
>> >> >> >
>> >> >> > I'm not sure that the second solution is a good one, because I
>> want
>> >> >> > one
>> >> >> > thread to listen to both regular sockets and monitor sockets,
>> >> >> > with that solution i have to do zmq_poll (with small timeout) and
>> >> >> > after
>> >> >> > the
>> >> >> > poll call the recv for all the monitoring sockets.
>> >> >> >
>> >> >> > Any suggestions?
>> >> >> >
>> >> >> > Thanks,
>> >> >> >
>> >> >> > Doron
>> >> >> >
>> >> >> > _______________________________________________
>> >> >> > zeromq-dev mailing list
>> >> >> > zeromq-dev at lists.zeromq.org
>> >> >> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> >> >> >
>> >> >> _______________________________________________
>> >> >> zeromq-dev mailing list
>> >> >> zeromq-dev at lists.zeromq.org
>> >> >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> >> >
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > zeromq-dev mailing list
>> >> > zeromq-dev at lists.zeromq.org
>> >> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> >> >
>> >> _______________________________________________
>> >> zeromq-dev mailing list
>> >> zeromq-dev at lists.zeromq.org
>> >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> >
>> >
>> >
>> > _______________________________________________
>> > zeromq-dev mailing list
>> > zeromq-dev at lists.zeromq.org
>> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> >
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>
>
> _______________________________________________
> 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/20121111/edf34a4f/attachment.htm>


More information about the zeromq-dev mailing list