Setting socket options in ZMQ.jl

223 views
Skip to first unread message

Salman Haider

unread,
Jul 18, 2016, 6:15:52 PM7/18/16
to julia-users

ZeroMQ has an option where the subscribe socket only keeps the last message. I was wondering if there is a way to specify that.
Something like the following:

using ZMQ
ctx
= Context()
s
= Socket(ctx, SUB)
ZMQ
.subscribe(s)
ZMQ
.set_subscribe(ZMQ.CONFLATE, 1)   # ERROR: LoadError: UndefVarError: CONFLATE not defined
ZMQ
.connect(s, "tcp://127.0.0.1:5001")


while true
 msg
= bytestring(ZMQ.recv(s))
 println
(msg)
end



The C++ analog would go something like this:
  zmq::context_t context (1);
  zmq
::socket_t subscriber (context, ZMQ_SUB);

 
int conflate = 1;

 
subscriber.setsockopt(ZMQ_CONFLATE, &conflate, sizeof(conflate) );   // need this in julia
  subscriber
.connect("tcp://localhost:5556");
  subscriber
.setsockopt(ZMQ_SUBSCRIBE, "", 0);


More generally, how are socket options specified in Julia?

Thanks.

Jeffrey Sarnoff

unread,
Jul 26, 2016, 2:03:15 AM7/26/16
to julia-users
How are ZMQ socket options specified in Julia?
 
the attached file may help you
ZMQ_sockets.jl
Reply all
Reply to author
Forward
0 new messages