# Are there any julia zmq.jl examples

**URL:** <https://discourse.julialang.org/t/are-there-any-julia-zmq-jl-examples/76996>\
**Category:** Performance\
**Tags:** package\
**Created:** [February 23, 2022, 10:04pm UTC](https://discourse.julialang.org/t/are-there-any-julia-zmq-jl-examples/76996 "2022-02-23T22:04:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon69491625](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@anon69491625](https://discourse.julialang.org/u/anon69491625)\
**Post date:** [February 23, 2022, 10:04pm UTC](https://discourse.julialang.org/t/are-there-any-julia-zmq-jl-examples/76996/1 "2022-02-23T22:04:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GHL](https://avatars.discourse-cdn.com/v4/letter/g/7feea3/32.png) [@GHL](https://discourse.julialang.org/u/GHL)\
**Post date:** [February 23, 2022, 10:46pm UTC](https://discourse.julialang.org/t/are-there-any-julia-zmq-jl-examples/76996/2 "2022-02-23T22:46:29Z")

</div>

The [ZMQ Guide](https://zguide.zeromq.org/) 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/](https://github.com/Eben60/LabVIEW0.jl/) can also serve as inspiration, allthough i didn’t use it myself.

---

<div class="post-metadata">

**Author:** ![anon69491625](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@anon69491625](https://discourse.julialang.org/u/anon69491625)\
**Post date:** [February 23, 2022, 10:58pm UTC](https://discourse.julialang.org/t/are-there-any-julia-zmq-jl-examples/76996/3 "2022-02-23T22:58:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)\
**Post date:** [January 4, 2023, 8:21am UTC](https://discourse.julialang.org/t/are-there-any-julia-zmq-jl-examples/76996/4 "2023-01-04T08:21:47Z")

</div>

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](http://wiki.zeromq.org/bindings:julia) where no examples are given.  
What is for example the Julia version of this Python code.

```python
#
# 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

```python
#
# 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}]")

```

---

<div class="post-metadata">

**Author:** ![GHL](https://avatars.discourse-cdn.com/v4/letter/g/7feea3/32.png) [@GHL](https://discourse.julialang.org/u/GHL)\
**Post date:** [January 4, 2023, 10:12am UTC](https://discourse.julialang.org/t/are-there-any-julia-zmq-jl-examples/76996/5 "2023-01-04T10:12:39Z")

</div>

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](https://github.com/JuliaInterop/ZMQ.jl/blob/master/src/ZMQ.jl) may give you some hints which building blocks to use. I am not sure wether the bindings are complete or not.
