An error occurs when the zsock_set_tcp_keepalive function is executed
wangxuheng opened this issue · 2 comments
Use the 4.2.2czmq version and the 4.3.5 zmq version
code:
socket->pub_intermsg = zsock_new(ZMQ_PUB);
VALID(socket->pub_intermsg);
zsock_set_tcp_keepalive (socket->pub_intermsg, 3);
assert (zsock_tcp_keepalive (socket->pub_intermsg) == 3);
zsock_set_tcp_keepalive_idle (socket->pub_intermsg, 30);
assert (zsock_tcp_keepalive_idle (socket->pub_intermsg) == 30);
zsock_set_tcp_keepalive_cnt (socket->pub_intermsg, 5);
assert(zsock_tcp_keepalive_cnt (socket->pub_intermsg) == 5);
zsock_set_tcp_keepalive_intvl (socket->pub_intermsg, 3);
assert(zsock_tcp_keepalive_intvl (socket->pub_intermsg) == 3);
zmq_setsockopt(socket->pub_intermsg, ZMQ_SNDHWM, &g_evd_hwm, sizeof (g_evd_hwm));
problem:
An error occurs when the zsock_set_tcp_keepalive function is executed
src/zsock_option.inc:2949: zsock_set_tcp_keepalive: Assertion rc == 0 || zmq_error() == (156384712 + 53)
failed.
zsock_set_tcp_keepalive
is a boolean option, so the only acceptable values are 0 and 1, or -1 for "not specified".
Also, your call to zmq_setsockopt
on the last line will not work because you are passing a CZMQ zsock_t
object where a libzmq socket handle is expected. You should use zsock_set_sndhwm
instead.
zsock_set_tcp_keepalive
is a boolean option, so the only acceptable values are 0 and 1, or -1 for "not specified".Also, your call to
zmq_setsockopt
on the last line will not work because you are passing a CZMQzsock_t
object where a libzmq socket handle is expected. You should usezsock_set_sndhwm
instead.
Thank you very much