ZeroMQ push socket causes client to not terminate when no process is listening

本秂侑毒 提交于 2019-12-05 14:48:20

This is most probably due to the linger functionality of ZeroMQ. Quoting from the man page:

The ZMQ_LINGER option shall set the linger period for the specified socket. The linger period determines how long pending messages which have yet to be sent to a peer shall linger in memory after a socket is closed with zmq_close(3), and further affects the termination of the socket's context with zmq_term(3).

The default value causes ZeroMQ to wait indefinitely until it is able to deliver the stuck message.

Try setting the ZMQ_LINGER socket option to zero or a short time (in milliseconds).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!