[zeromq-dev] question about zmq_poll() with timeout on Windows
Ivan Pechorin
ivan.pechorin at gmail.com
Tue Feb 9 18:29:46 CET 2010
Hi
I'm trying to implement a loop with zmq_poll() on a single ZMQ_REP
socket, and non-zero timeout set, and always get the following error:
Assertion failed: Invalid argument (..\..\..\src\zmq.cpp:514)
Here is the minimal piece of code to reproduce the problem:
#include <zmq.hpp>
int main(int argc, char* argv[])
{
int rc;
zmq::context_t ctx(1, 1, ZMQ_POLL);
zmq::socket_t s(ctx, ZMQ_REP);
s.bind("tcp://192.168.1.99:5555");
zmq::pollitem_t items[1];
while(1) {
items[0].socket = s;
items[0].fd = -1;
items[0].events = ZMQ_POLLIN;
items[0].revents = 0;
rc = zmq_poll(items, 1, 30000000);
assert(rc != -1);
}
return 0;
}
Tried to debug it. It looks like the problem happens when zmq_poll()
is called second time (i.e. second iteration of my loop): the select()
function of Winsock is called with all three descriptor parameters
being null in zmq.cpp:511, hence we get WSAEINVAL (translated into
"Invalid argument" by wsa_assert).
Could you please tell me, what's wrong with my code, provided above?
P.S. I use Visual Studio 2008 SP1 on 32-bit Windows Server 2003.
Best regards, Ivan
More information about the zeromq-dev
mailing list