Skip to content

rdeits/ZMQ.jl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Julia interface to ZeroMQ

Build Status Build status

ZMQ.jl is a Julia interface to ZeroMQ, The Intelligent Transport Layer.

ZMQ version 3 or later is required; ZMQ version 2 is not supported.

Installation

Pkg.add("ZMQ")

Install the ZeroMQ libraries for your OS using your favourite package manager.

Usage

using ZMQ

ctx=Context()
s1=Socket(ctx, REP)
s2=Socket(ctx, REQ)

ZMQ.bind(s1, "tcp://*:5555")
ZMQ.connect(s2, "tcp://localhost:5555")

ZMQ.send(s2, Message("test request"))
msg = ZMQ.recv(s1)
out=convert(IOStream, msg)
seek(out,0)
#read out::MemIO as usual, eg. read(out,...) or takebuf_string(out)
#or, conveniently, use unsafe_string(msg) to retrieve a string

ZMQ.send(s1, Message("test response"))
ZMQ.close(s1)
ZMQ.close(s2)
ZMQ.close(ctx)

Troubleshooting

If you are using Windows and get an error Provider PackageManager failed to satisfy dependency zmq, you may need to restart Julia and run Pkg.build("ZMQ") again. See issue #69 for more details.

About

Julia interface to ZMQ

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Julia 100.0%