Hello,
I've been having some problems with polling for messages between two
remote computers or a computer and VM. I managed to write a small
reproducible program.
It is two 32bit test programs written in c++ in windows (7) (zmq 3.2.4)
that form a simple REQ/REP loop. In the REP program after I bind the
socket I run the following loop :
While(1) {
mySocket.getsockopt(ZMQ_FD, &sock, &sock_size);
hRecvEvent = ::WSACreateEvent();
WSAEventSelect(sock, hRecvEvent, FD_ALL_EVENTS );
WSAResetEvent(hRecvEvent);
DWORD retVal = WaitForSingleObject(hRecvEvent, 1000);
if (retVal == WAIT_OBJECT_0)
{
::WSAResetEvent(hRecvEvent);
int events = 0;
do {
events = 0;
size_t eventsSize = sizeof(events);
mySocket.getsockopt(ZMQ_EVENTS, &events, &eventsSize);
if (events & ZMQ_POLLIN) {
mySocket.rev(&message);
mySocket.send(reply);
}
} while (events & ZMQ_POLLIN);
}
}
When the two programs are running on remote computers or on VMs the
"WaitForSingleObject" never triggers for the first message. If I force
the first receive/reply pair
Everything runs fine after that. I'm not sure what the problem could be
but I also noticed that if I add "mySocket.getsockopt(ZMQ_EVENTS,
&events, &eventsSize);" just after the bind and before the loop the
problem also goes away. Does this maybe have something to do with the
sockets not being ready ?
Hopefully you guys might be able to help me ....
Ivo
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev