[zeromq-dev] zmq_getsockopt issue with ZMQ_FD
KIU Shueng Chuan
nixchuan at gmail.com
Tue Nov 4 00:31:47 CET 2014
"rc != -1" usually means success.
Your code snippet also doesn't initialize "fd_size".
On Tue, Nov 4, 2014 at 6:54 AM, Saurav Dasgupta <saurav.dasgupta82 at gmail.com
> wrote:
> I am facing some problem in retrieving the socket associated with the
> subscriber.
> 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));
> }
> zmq_setsockopt(subscriber,ZMQ_SUBSCRIBE,"",0);
> 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
> environment.
>
> Regards,
> Saurav
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20141104/b16fbf74/attachment.htm>
More information about the zeromq-dev
mailing list