I wrote a zmq proxy with zmq_poll()
with 3 frontends and 3 backends and timeout of -1 which makes it endless. Frontend sockets use the connection-oriented tcp://
-transport-class and are zmq_bind()
associated with the tcp
-ports on the host IP-address like tcp://192.168.1.1:1000
.
Is there any way to break endless zmq_poll( ..., ..., -1 )
loop when my host's IP address changed?
while(1) {
zmq_msg_t message;
zmq_pollitem_t items [] = {
{ frontend1, 0, ZMQ_POLLIN, 0 },
{ backend1, 0, ZMQ_POLLIN, 0 },
};
zmq_poll (items, 2, -1);
if(items[0].revents & ZMQ_POLLIN) {
...
}
if(items[1].revents & ZMQ_POLLIN) {
...
}
}
I've tried to poll for events like ZMQ_POLLIN | ZMQ_POLLERR
but when I changed host's IP address manually it does not return from a call to zmq_poll( ..., ..., -1 )
.