Closed SpaceMonkeyForever closed 2 years ago
I've not used Java but in C you would:
zsock_t *sub_socket = zsock_new(ZMQ_SUB);
rc = zsock_bind(sub_socket, "tcp://127.0.0.1:1234");
zsock_set_subscribe(sub_socket, "");
Should be the same in Java.
I know there are convenience methods that do this for you but I generally not use them.
The problem is that in Java, there is no equivalent to "zsock_bind".
very strange.... I've just found the "bind" method. I don't know why I couldn't see it before. Checking
In ZMQ, you can subscribe and
bind
(instead ofconnect
) to a URL so that anyone can publish to you.Here is how to do it in Python:
I'm trying to do that using the Java bindings, but there is no "connect" or "bind". A subscriber socket is created using
Zsock.newSub
:How do I
bind
using CZMQ?