[zeromq-dev] ZMQ_RCVTIMEO isn't enforced

Mos Yud mos.yud at gmail.com
Sun Jun 25 15:14:40 CEST 2017


My bad. I should have used client->setsockopt(ZMQ_RCVTIMO, timeout) instead
of zmq_setsockopt(client, ZMQ_RCVTIMEO, &timeout, sizeof(int))

Thx.

On Sun, Jun 25, 2017 at 3:25 PM, Luca Boccassi <luca.boccassi at gmail.com>
wrote:

> On Sun, 2017-06-25 at 14:26 +0300, Mos Yud wrote:
> > Hi,
> >
> > 2 questions:
> >
> > 1. I have one client and no server (no server is running). I also
> > have the
> > following code:
> >
> > *    zmq::context_t context(1);*
> >
> > *    zmq::socket_t * client = s_client_socket(context);*
> >
> > *    // set receive timeout*
> > *    int timeout = 10;*
> > *    int res = zmq_setsockopt(client, ZMQ_RCVTIMEO, &timeout,
> > sizeof(int));*
> >
> >
> > s_client_socket(...) looks like this:
> >
> > static zmq::socket_t * s_client_socket(zmq::context_t & context) {
> >     zmq::socket_t * client = new zmq::socket_t(context, ZMQ_REQ);
> >     client->connect("tcp://localhost:5555");
> >
> >     //  Configure socket to not wait at close time
> >     int linger = 0;
> >     client->setsockopt(ZMQ_LINGER, &linger, sizeof(linger));
> >
> >     return client;
> > }
> >
> > After this code is activated, client is connected (even-though there
> > is no
> > server listening).
> > Then i invoke socket.send(...) and the socket.recv(...),  and i get
> > that
> > the recv is blocked and doesn't return after the timeout i set above.
> > Any suggestion for this issue?
>
> It works fine with just libzmq, so maybe try without the C++ bindings
>
> > 2. Does ZMQ support named pipes for windows? I only found sockets, so
> > please correct if i am wrong here.
>
> It does not.
>
> Kind regards,
> Luca Boccassi
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20170625/ef7ed54a/attachment.htm>


More information about the zeromq-dev mailing list