[zeromq-dev] Question about ROUTER queue (what if client dies)
Pedro Januário
prnjanuario at gmail.com
Mon Jul 28 15:42:50 CEST 2014
hi Peter,
I didn’t write C code for a while, but would be something like this:
#include <czmq.h>
int main (void)
{
zsock_t *router = zsock_new_router ("tcp://127.0.0.1:9990");
zsock_t *dealer = zsock_new_dealer ("tcp://127.0.0.1:9990");
// dealer send message
zstr_send (dealer, "Hello World");
// router received message
zmsg_t *msg = zmsg_recv (router);
zmsg_print (msg);
// dealer (client) disconnects permanently
zsock_destroy (&dealer);
// router send message to dealer, because it thinks that is connected
zmsg_send (&msg, router);
zmsg_destroy (&msg);
zsock_destroy (&router);
return 0;
}
I hope this is self explanatory.
One way to solve this, is by sending “good bye” message from dealer (client), but for my use case would be enough discharge message that are send after x minutes.
Regards,
Pedro Januário Delivering Innovation and Technology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140728/e6021934/attachment.htm>
More information about the zeromq-dev
mailing list