Yes. In ZMQ the send operation is blocking until the message could be queued to the socket[1]. Not however that the socket in question is the sending socket not the receiving one. The sending Dealer-Socket is itself supposed to block once its High-Water-Mark has been reached due to no receiving sockets being available[2].
You can however add the ZMQ_NOBLOCK flag to the send operation that does not block but sets the errno integer to EAGAIN (afaik you can also check the returned integer of zmq_send())[1]. In that case the Dealer-Socket would still reach its HWM but the send operation would not block. However that's probably not what you want ;). Still wanted to share that detail. Best, alex. [1]: http://api.zeromq.org/2-1:zmq-send [2]: http://api.zeromq.org/2-1:zmq-socket#toc6 On 03.08.2016 18:44, Tobias Elbert wrote: > Actually I think I just answered my own question: > > > In my case the socket is connected on a virtual VPN adapter and the VPN > is still a bit flaky. We're still in the process of setting that up > properly and I think what happened was that the VPN server machine went > into hibernation so the sending socket's endpoint was no longer > available. From memory this lines up time-wise with the other incidents > I have mentioned (VPN going down and the socket blocking). > > > I suppose default behaviour also for Dealer sockets is to block and wait > until the endpoint becomes available again rather than enqueue on its > internal message queue? > > > Thanks > > Tobias > > > > ------------------------------------------------------------------------ > *From:* zeromq-dev <zeromq-dev-boun...@lists.zeromq.org> on behalf of > Tobias Elbert <tobias_elb...@hotmail.com> > *Sent:* Wednesday, August 3, 2016 5:18 PM > *To:* zeromq-dev@lists.zeromq.org > *Subject:* [zeromq-dev] Polling issue. Socket blocking on SendMessage > > > Hi all, > > I am having an issue with a setup similar to the sample in the Pastebin > link provided below. Basically I let the poller block for 2 seconds and > every 6 seconds send out a heartbeat from within the polling loop. My > understanding is that while I’m in the polling loop that it is safe to > do sends/ receives on any of the sockets on the poller. > > This works fine for a few hours but after 2-3 hours (sometimes can also > go for a whole day without issues). I put a fully functioning sample on > Pastebin: > > http://pastebin.com/diN8ymmD > <http://pastebin.com/diN8ymmD> > > [C#] C# Bindings. Polling issue. Socket blocking on SendMessage - > Pastebin.com <http://pastebin.com/diN8ymmD> > pastebin.com > > > > For clarity, here the piece of code where the SendMessage call blocks > indefinitely: > > while(true) > { > poller.Poll(TimeSpan.FromSeconds(2)); > > if ((DateTime.UtcNow - lastHeartbeat).TotalSeconds > 5) > { > ZmqMessage hbMessage = new ZmqMessage(); > > hbMessage.Append(Encoding.ASCII.GetBytes(HeartBeatMsg)); > > Console.WriteLine("About to send Heartbeat {0}", DateTime.Now); > // blocks here after a while: > frontend.SendMessage(hbMessage); // blocks here > > Console.WriteLine("Sent Heartbeat {0}", DateTime.Now); > > lastHeartbeat = DateTime.UtcNow; > } > } > > Note I am using v3.2.5 libzmq and its corresponding C# bindings. > > > Any input would be appreciated. > > Thanks Tobias. > > > > > _______________________________________________ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > _______________________________________________ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev