Hey all,

I might me missing something but is there any way of detecting messages being dropped due to the high watermark on a PUB socket?

It's clear how to do this is on a socket that blocks in the mute state, but dropping message on mute is not?

for example:

// test hwm
sock_t *push = zsock_new(ZMQ_PUB);
zsock_t *pull = zsock_new(ZMQ_SUB);
zsock_set_rcvhwm(pull, 100);
zsock_set_sndhwm(push, 100);
zsock_set_sndtimeo(push,0);
zsock_bind(push, "inproc://test");
zsock_connect(pull, "inproc://test");
zsock_set_subscribe(pull, "");
zclock_sleep(10);
int rc = 0;
int count = 0;
while( rc == 0 && count < 10000) {
    rc = zstr_send(push, "BOE");
    count++;
}

The count will be 10000 due zstr_send dropping messages but returning 0;
If we then receive the buffered messages we wil receive 20 messages (rcvhwm + sndhwm)

int count2 = 0;
char *m = "";
while ( m )
{
    char *m = zstr_recv_nowait(pull);
    count2++;
}

Rg,

Arnaud
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
https://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to