Are there any julia zmq.jl examples

I am investigating using ZMQ to move a data stream around my project and would like to see some examples but I can’t find any for julia. My use case is to take streamed data and filter it to other julia scripts running on other machines.

The ZMQ Guide provides some julia examples.
I was using it for communication between Labview and Julia and the performance was good. Maybe some code from https://github.com/Eben60/LabVIEW0.jl/ can also serve as inspiration, allthough i didn’t use it myself.

1 Like

OUTSTANDING!!! @GHL I missed the examples in the guide. I REALLY have to get to grips with this reading stuff. Thanks so much I am a happy bunny.

1 Like

I’m sorry but I can’t find Julia examples in the guide. When clicking on “Choose” I can only get examples for C, C++, C#, Dart, Erlang, F#, Go, Haskell, Java, NodeJS, Perl, Python, Ruby, Rust… not Julia.
I only see the following page Julia - zeromq where no examples are given.
What is for example the Julia version of this Python code.

#
#   Hello World server in Python
#   Binds REP socket to tcp://*:5555
#   Expects b"Hello" from client, replies with b"World"
#

import time
import zmq

context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind("tcp://*:5555")

while True:
    #  Wait for next request from client
    message = socket.recv()
    print(f"Received request: {message}")

    #  Do some 'work'
    time.sleep(1)

    #  Send reply back to client
    socket.send(b"World")

and

#
#   Hello World client in Python
#   Connects REQ socket to tcp://localhost:5555
#   Sends "Hello" to server, expects "World" back
#

import zmq

context = zmq.Context()

#  Socket to talk to server
print("Connecting to hello world server…")
socket = context.socket(zmq.REQ)
socket.connect("tcp://localhost:5555")

#  Do 10 requests, waiting each time for a response
for request in range(10):
    print(f"Sending request {request} …")
    socket.send(b"Hello")

    #  Get the reply.
    message = socket.recv()
    print(f"Received reply {request} [ {message} ]")

The basics chapter is covered, but everything/most other examples still miss a translation.
Anyway, the basics chapter includes a hwserver example in julia which may already solve your problems?
Otherwise the zmq.jl may give you some hints which building blocks to use. I am not sure wether the bindings are complete or not.