dummy-link

ZMQancient

An archival version of ZMQ.jl for julia_matlab

Readme

NOTE: archival version

This is an old version of ZMQ.jl that existed at the time julia-matlab was created. People have expressed an interest in getting that working again, so this is posted for their benefit.

If you're interested in a "modern" interface to ZeroMQ, see the official ZMQ package.

What follows is the old README.

A Julia interface to ZeroMQ

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

This codebase has been tested to work with ZeroMQ version 2. Support for version 3 of ZeroMQ is stil incomplete, and is in progress.

Installation

Pkg.add("ZMQ")

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

Usage

using ZMQ

ctx=ZMQContext(1)
s1=ZMQSocket(ctx, ZMQ_REP)
s2=ZMQSocket(ctx, ZMQ_REQ)

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

ZMQ.send(s2, ZMQMessage("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 ASCIIString[msg] to retrieve a string

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

RPC

This package includes an RPC mechanism to remotely execute julia functions, possibly from different programming languages. The on-the-wire protocol used for passing messages is the standard Julia serialisation format built into the standard library.

As the functionality matures, this may be split into a separate package.

require("ZMQ/src/RPCJuliaSer")
using RPCJuliaSer
run_server() #using port 5555 by default

In a separate Julia session

julia> require("ZMQ/src/RPCJuliaSer")

julia> using RPCJuliaSer

julia> ctx,req=launch_client()
(ZMQContext(Ptr{Void} @0x0000000103b7a600),ZMQSocket(Ptr{Void} @0x0000000103b6e890))

julia> zmqparse(req, "2+2")
4

First Commit

05/05/2015

Last Touched

about 2 months ago

Commits

18 commits