"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.dasgupt...@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@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to