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
[email protected]<mailto:[email protected]>
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.
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to