[zeromq-dev] zmq_poll when socket is closed
Auer, Jens
jens.auer at cgi.com
Tue Oct 13 17:49:50 CEST 2015
Hi,
what is the semantics of zmq_poll when the remote side of the socket is closed? My sample program
int main()
{
zmq::context_t ctx;
zmq::socket_t s1{ctx, ZMQ_PAIR};
zmq::socket_t s2{ctx, ZMQ_PAIR};
s1.bind("inproc://1");
s2.connect("inproc://1");
auto t = std::thread( [&]() {
std::this_thread::sleep_for( std::chrono::seconds(5) );
s1.close();
});
zmq::pollitem_t pollitems[] = { {static_cast<void*>(s2), -1, ZMQ_POLLIN + ZMQ_POLLERR + ZMQ_POLLOUT, 0} };
auto rc = zmq::poll(pollitems, 1);
std::cout << rc << std::endl;
std::cout << pollitems[0].revents;
t.join();
return 0;
}
prints 2 which is ZMQ_POLLOUT. However, I cannot see this in the documentation.
Best wishes,
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20151013/b38eb312/attachment.htm>
More information about the zeromq-dev
mailing list