[zeromq-dev] Question about context and/or socket creation

James Chapman james at linux-101.org
Fri Sep 30 11:50:23 CEST 2016


[apologies if you've received this twice, first send was not from my
subscribed email address and I'm not sure it actually went to the list]

Hi all,

Quick question regarding the creation of contexts and sockets. Some quick
insight:
I have a function that gets called from a thread pool that creates a
context, a socket, sends a REQ message and waits for a REP, after which the
socket is closed and then deleted. If the program runs for long enough, it
eventually crashes, the last call being in zmq.hpp (line 657)

zmq::socket_t::init(zmq::context_t & context_, int type_)
{
...
    ptr = zmq_socket (context_.ptr, type_ );   <--- Crash here



So my question is basically, am I using contexts and sockets correctly by
creating new instances each time I want to send a message or should I be
re-using these as much as possible?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20160930/f32c539d/attachment.htm>


More information about the zeromq-dev mailing list