[zeromq-dev] querying what a SUB socket is subscribed to

Martin Sustrik sustrik at 250bpm.com
Wed Oct 26 13:56:15 CEST 2011


Hi Gaspar,

> is there a way to query what subscriptions a socket has? I'm using PyZMQ
> (2.1.10 with zmq 2.1.10), and I've tried getsockopt as suggested by the
> documentation, but I get the following error:
>
>   >>>  s.setsockopt(zmq.SUBSCRIBE, "foo")
>   >>>  s.getsockopt(zmq.SUBSCRIBE)
> Traceback (most recent call last):
>     File "<stdin>", line 1, in<module>
>     File "socket.pyx", line 331, in zmq.core.socket.Socket.getsockopt
> (zmq/core/socket.c:3202)
> zmq.core.error.ZMQError: Invalid argument
>
> What am I doing wrong?

Can you point to the documentation that suggest that getsockopt can be 
used with ZMQ_SUBSCRIBE? That kind of thing is not possible and the 
documentation should be fixed to reflect the fact.

Martin



More information about the zeromq-dev mailing list