[zeromq-dev] zmq_getsockopt issue with ZMQ_FD

Saurav Dasgupta saurav.dasgupta82 at gmail.com
Mon Nov 3 23:54:04 CET 2014

I am facing some problem in retrieving the socket associated with the
In my case, the subscriber is spawned before the Publisher.
rc = zmq_getsockopt(subscriber, ZMQ_FD, z_fd, &fd_size); is returning -1
although the errorno is giving as SUCCESS.

Here is the code snippet

context = zmq_ctx_new();
subscriber = zmq_socket(context, ZMQ_SUB);
rc = zmq_connect(subscriber,"tcp://localhost:5556");
if (rc != 0) {
        printf("error in zmq_connect: %s\n", zmq_strerror (errno));
 z_fd = malloc(sizeof(int));
 rc = zmq_getsockopt(subscriber, ZMQ_FD, z_fd, &fd_size);
 if (rc != -1) {
        printf("error in zmq_getsockopt: %s\n", zmq_strerror (errno));

Is there any known issue with zmq_getsockopt.. Also i using a Linux

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20141103/4c474fc1/attachment.htm>

More information about the zeromq-dev mailing list