Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error occurs when the zsock_set_tcp_keepalive function is executed #2268

Open
wangxuheng opened this issue Jun 29, 2023 · 2 comments
Open

Comments

@wangxuheng
Copy link

wangxuheng commented Jun 29, 2023

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.

@stephenprocter
Copy link
Contributor

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.

@wangxuheng
Copy link
Author

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.

Thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants