[zeromq-dev] Zloop and ZMQ_DEALER/ZMQ_ROUTER Issue.

Rodrigo Mosconi mosconi.rmg at gmail.com
Thu Sep 11 17:53:35 CEST 2014


It`s missing the "identity" frame in the zmsg from the ROUTER to DEALER.
As described on zguide, the router NEED to send a message with:

<identity frame>
<> -- a empty frame
<data/payload>

On Thu, Sep 11, 2014 at 12:43 PM, Kurt Degiorgio <kurt.degiorgio at gfi.com>
wrote:

> Hi,
>
>
>
> I have an issue that when a sending from a ROUTER to a DEALER nothing is
> received but when sending from  DEALER to ROUTER it works.
>
>
>
> This is my  implementation  ( I am using CSMQ)
>
>
>
> What am I doing wrong?  (Code below)
>
>
>
> Thanks!
>
>
>
> *Two instances of the ‘*aClass’ object each class *one for DEALER and one
> for ROUTER*
>
>
>
> Int processthread(PVOID ptrcontext)
>
> {
>
>     aClass* ptrclass = static_cast<aClass*> (ptrcontext);
>
>
>
>     if(ptrclass->isRouter())
>
>     {
>
>         ptrclass->m_ptrsocket_router = zsock_new (ZMQ_ROUTER)
>
>         assert (ptrclass->m_ptrsocket);
>
>         if(zsock_bind(ptrclass->m_ptrsocket, ,"tcp://127.0.0.1:40") ==  -1)
>
>         {
>
>            //Error
>
>         }
>
>     }
>
>     else
>
>     {
>
>         Sleep(5000);
>
>         ptrclass->m_ptrsocket = zsock_new (ZMQ_DEALER);
>
>         assert (ptrclass->m_ptrsocket);
>
>         if(zsock_connect(ptrclass->m_ptrsocket, "tcp://127.0.0.1:40") ) == -1)
>
>         {
>
>             //Error
>
>         }
>
>     }
>
>
>
>     zloop_t *ptrloop = zloop_new ();
>
>      assert (ptrloop);
>
>     zloop_set_verbose (ptrloop, TRUE);
>
>      int timer_id = zloop_timer (ptrloop,500,0,_timerfired, ptrclass);
>
>
>
>     zloop_reader (ptrloop, ptrclass->m_ptrsocket, _datarecieved, ptrclass);
>
>     zloop_reader_set_tolerant (ptrloop, ptrclass->m_ptrsocket);
>
>     zloop_start(ptrloop);
>
>      zsock_destroy(&ptrclass->m_ptrsocket);
>
>     zloop_destroy(&ptrloop);
>
>      return 0;
>
> }
>
>
>
> int _timerfired(zloop_t *ptrloop, int timer_id, void *ptrcontext)
>
> {
>
>     aClass* ptrclass = static_cast<aClass*> (ptrcontext);
>
>
>
>     if(ptrclass->isRouter())
>
>     {
>
>          zmsg_t* ptrmsg = zmsg_new();
>
>          assert(ptrmsg);
>
>          zmsg_addstr(“POKE”);
>
>          zmsg_send(&ptrmsg, ptrclass->m_ptrsocket);
>
>     }
>
>     return 0;
>
> }
>
>
>
>
>
> int  _datarecieved (zloop_t *ptrloop, zsock_t *ptrreader,void* ptrcontext)
>
> {
>
>    // only being called when sending from dealer to router!!! L
>
> }
>
>
>
> <http://gfidisc.gfi.com>
>
> *DISCLAIMER*
> The information contained in this electronic mail may be confidential or
> legally privileged. It is for the intended recipient(s) only. Should you
> receive this message in error, please notify the sender by replying to this
> mail. Please do not read, copy, forward or store this message unless you
> are an intended recipient of it - unauthorized use of contents is strictly
> prohibited. Unless expressly stated, opinions in this message are those of
> the individual sender and not of GFI. While all care has been taken, GFI is
> not responsible for the integrity of and that of the contents of this
> electronic mail and any attachments included within.
>
>
>
> <http://gfidisc.gfi.com>
>
> _______________________________________________
> 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/20140911/6ed45594/attachment.htm>


More information about the zeromq-dev mailing list