A Julia interface to ZeroMQ
(This installs its own copy of the ZMQ libraries from the ZMQBuilder repository.)
using ZMQ s1=Socket(REP) s2=Socket(REQ) bind(s1, "tcp://*:5555") connect(s2, "tcp://localhost:5555") send(s2, "test request") msg = recv(s1, String) send(s1, "test response") close(s1) close(s2)
send(socket, x) and
recv(socket, SomeType) functions make an extra copy of the data when converting
between ZMQ and Julia. Alternatively, for large data sets (e.g. very large arrays or long strings), it can
be preferable to share data, with
send(socket, Message(x)) and
msg = recv(Message), where the
object acts like an array of bytes; this involves some overhead so it may not be optimal for short messages.
(Help in writing more detailed documentation would be welcome!)
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.