I have this implementation to create a socket :
if (gctx == nullptr)
{
gctx = zmq_ctx_new();
gsock = zmq_socket(gctx, ZMQ_REQ);
}
snprintf(url, sizeof(url), "wsd:///tmp/hfg/%s", name);
int rc = zmq_connect(gsock, url);
if (rc != 0)
printf("error connect %s: %s\n", url, zmq_strerror(zmq_errno()));
return rc;
But I want to be able to create multiple sockets, not just one. How is this done? Do I also need multiple contexts? I mean for every socket a context.