[zeromq-dev] ROUTER-to-REP (C++ ) error on Window

Hoàng Minh Hải haihm1983 at gmail.com
Fri Oct 12 08:59:32 CEST 2012


Hi,

I found the problem with the code (zhelpers.hpp)
*int64_t more;           //  Multipart detection*
*        size_t more_size = sizeof (more);*
*        socket.getsockopt(ZMQ_RCVMORE, &more, &more_size);*
*
*
*        if (!more)*
*            break;      //  Last message part*

I fixed as following :
*int more;           //  Multipart detection*
*        size_t more_size = sizeof (more);*
*        socket.getsockopt(ZMQ_RCVMORE, &more, &more_size);*
*
*
*        if (!more)*
*            break;      //  Last message part*

On Fri, Oct 12, 2012 at 12:51 PM, Pieter Hintjens <ph at imatix.com> wrote:

> Hi,
>
> Can you please try the C versions? I'm not sure the C++ example code
> is correct any longer.
>
> -Pieter
>
> On Fri, Oct 12, 2012 at 10:40 AM, Hoàng Minh Hải <haihm1983 at gmail.com>
> wrote:
> >
> > I run the code (http://zguide.zeromq.org/cpp:rtpapa) on Window (ZeroMQ
> > version 3.2.0) and get a error (errno = EFSM and comment "If we are in
> > middle of sending a reply, we cannot receive next request."). Help me fix
> > this!
> >
> > // http://zguide.zeromq.org/cpp:rtpapa
> > // Custom routing Router to Papa (ROUTER to REP)
> > //
> > // Olivier Chamoux <olivier.chamoux at fr.thalesgroup.com>
> >
> > #include "zhelpers.hpp"
> >
> > // We will do this all in one thread to emphasize the sequence
> > // of events…
> > int main () {
> > zmq::context_t context(1);
> >
> > zmq::socket_t client (context, ZMQ_ROUTER);
> > client.bind("inproc://routing.inproc");
> >
> >     //client.bind("tcp://127.0.0.1:5959");
> >
> > zmq::socket_t worker (context, ZMQ_REP);
> > worker.setsockopt(ZMQ_IDENTITY, "A", 1);
> > worker.connect("inproc://routing.inproc");
> >
> >     //client.bind("tcp://127.0.0.1:5959");
> >
> > // Wait for sockets to stabilize
> > sleep (1000);
> >
> > // Send papa address, address stack, empty part, and request
> > s_sendmore (client, "A");
> > s_sendmore (client, "address 3");
> > s_sendmore (client, "address 2");
> > s_sendmore (client, "address 1");
> > s_sendmore (client, "");
> > s_send (client, "This is the workload");
> >
> > // Worker should get just the workload
> > s_dump (worker);
> >
> > // We don't play with envelopes in the worker
> > s_send (worker, "This is the reply");
> >
> > // Now dump what we got off the ROUTER socket…
> > s_dump (client);
> >
> > return 0;
> > }
> >
> >
> > --
> > Thanks & best regards,
> > Hải
> > -------------------------
> > Skype: victor.hoang.2911
> >
> > _______________________________________________
> > 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
>



-- 
Thanks & best regards,
Hải
-------------------------
Mobile: 0979830886
Ym: minhhai2911 at yahoo.com
Skype: victor.hoang.2911
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20121012/b4865ddc/attachment.htm>


More information about the zeromq-dev mailing list