[zeromq-dev] Empty message does not close ZMQ_STREAM socket?

Auer, Jens jens.auer at cgi.com
Tue Mar 22 16:11:35 CET 2016


Hi,

ZMQ_STREAM sockets are special and do not follow the normal behavior w.r.t ZMQ_SNDMORE. You always have to send two messages, the first one is discarded as the identity frame. If you omit ZMQ_SNDMORE once, you will not be able to send any messages over the socket again.

I also tried with and without ZMQ_SNDMORE for the empty message. It does not make a difference, but sending it twice does.

Cheers,
  Jens

--
Jens Auer | CGI | Software-Engineer
CGI (Germany) GmbH & Co. KG
Rheinstraße 95 | 64295 Darmstadt | Germany
T: +49 6151 36860 154
jens.auer at cgi.com<mailto:jens.auer at cgi.com>
Unsere Pflichtangaben gemäß § 35a GmbHG / §§ 161, 125a HGB finden Sie unter de.cgi.com/pflichtangaben<http://de.cgi.com/pflichtangaben>.

CONFIDENTIALITY NOTICE: Proprietary/Confidential information belonging to CGI Group Inc. and its affiliates may be contained in this message. If you are not a recipient indicated or intended in this message (or responsible for delivery of this message to such person), or you think for any reason that this message may have been addressed to you in error, you may not use or copy or deliver this message to anyone else. In such case, you should destroy this message and are asked to notify the sender by reply e-mail.
________________________________
Von: zeromq-dev-bounces at lists.zeromq.org [zeromq-dev-bounces at lists.zeromq.org]" im Auftrag von "Osiris Pedroso [opedroso at gmail.com]
Gesendet: Dienstag, 22. März 2016 15:03
An: ZeroMQ development list; KIU Shueng Chuan
Betreff: Re: [zeromq-dev] Empty message does not close ZMQ_STREAM socket?

If I am completely off here, please let me know (still learning ZMQ):

    server.send(id, ZMQ_SNDMORE);
    server.send(empty, ZMQ_SNDMORE );

But I don't think you should have the ZMQ_SENDMORE flag on the second send() call.

Otherwise the message will not be sent, instead waiting for another call to send() without the flag which only then commits the message to be sent by underlying code.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20160322/1c0d05de/attachment.htm>


More information about the zeromq-dev mailing list