To start with
zmq_socket.connect(zmq_tcp1)
is not Julia syntax, correct syntax is
connect(zmq_socket, zmq_tcp1)
In other words, you don't invoke method of an object with 1 argument, but
instead invoke a function with 2 arguments.
On Wednesday, July 15, 2015 at 1:54:48 AM UTC+3, Dejan Miljkovic wrote:
>
> Hi there,
>
> I would like to use ZMQ in order to connect several processes that are
> publishing messages and one that is receiving the messages.
> I am having problem creating subscribe code.
>
> The publish code for one process looks like this:
>
> using ZMQ
>
> zmq_tcp ="tcp://*:5554"
> zmq_ctx = Context(1)
> zmq_socket = Socket(zmq_ctx, PUB)
> ZMQ.bind(zmq_socket, zmq_tcp)
> while true
> msg = "aaa"
> ZMQ.send(zmq_socket, Message(msg))
> println("Publish: ", msg)
> end
>
> I found python example (
> http://learning-0mq-with-pyzmq.readthedocs.org/en/latest/pyzmq/patterns/pubsub.html)
>
> but I am not able to find corresponding Julia calls.
>
> Subscriber code should be something like this:
>
> using ZMQ
>
> zmq_tcp1 ="tcp://localhost:5553"
> zmq_tcp2 ="tcp://localhost:5554"
> zmq_ctx = Context(1)
> zmq_socket = Socket(zmq_ctx, SUB)
> zmq_socket.connect (zmq_tcp1)
> zmq_socket.connect (zmq_tcp2)
>
> while true
> println("Waiting")
> msg = bytestring(ZMQ.recv(zmq_socket))
> println(msg)
>
> end
>
>
> Thanks,
>
> Dejan
>