[zeromq-dev] Heartbeating

Stephen Gray riskybizlive at live.com
Thu Nov 30 21:33:49 CET 2017


I'm creating a test piece which demonstrates the functionality I'd ultimately like to build into my application.  I'm trying to understand the built-in heartbeating options and have been fiddling around trying to get it set up.  Trial and error isn't getting me very far! I have a few questions, hope someone might be able to help....


1.       Does the built-in  heartbeating respect the direction of flow of the socket type eg. PUB-SUB is one directional, ROUTER-DEALER is bidirectional?  So in a unidirectional case an ephemeral value with a time-to-live would be issued from the source, but in a bidirectional case pings and pongs would go back and forth?



2.       The heartbeating works with curve security enabled, right?



3.       I've set up a server and client like so;



zsock_t *server = zsock_new(ZMQ_PUSH);

zsock_set_heartbeat_ivl(server, 50);

zcert_apply(server_cert, server);

zsock_set_curve_server(server, 1);

int rc = zsock_bind(server, "tcp://*:9000");





zsock_t *client = zsock_new (ZMQ_PULL);

zcert_apply (client_cert, client);

zsock_set_curve_serverkey (client, zcert_public_txt (server_cert));

//Set heartbeat interval

zsock_set_heartbeat_ttl(client, 1000);

zsock_set_heartbeat_ivl(client, 2500);

int rc1 = zsock_connect(client, "tcp://127.0.0.1:9000");



the interval settings are intended for testing purposes to provoke  a heartbeat timeout for which I am monitoring "DISCONNECTED" socket events.  Am I setting up the heartbeating correctly?



Thanks,



Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20171130/843f29e5/attachment.htm>


More information about the zeromq-dev mailing list