[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Workaround missing functions in the zeromq package

From: Ardid, Salva
Subject: Workaround missing functions in the zeromq package
Date: Sun, 21 Apr 2019 23:54:09 +0000


I started working to support Octave in Transplant using the zeromq package in Octave Forge. It’s the first time I use anything related to ZMQ and I reached a point where I’m stacked because Transplant uses zmq_msg_init, zmq_msg_recv, zmq_msg_data and zmq_msg_close, which are not yet supported in Octave’s package.

So, I wonder, would there be some way to implement the same functionality just using zmq_recv?

For the case it is useful, this is the piece of code I would need to adapt:

msg = libstruct('zmq_msg_t', struct('hidden', zeros(1, 64, 'uint8')));
calllib('libzmq', 'zmq_msg_init', msg); % always returns 0
msglen = calllib('libzmq', 'zmq_msg_recv', msg, obj.socket, 0);
assert(msglen >= 0, obj.errortext('zmq_msg_recv'));
msgptr = calllib('libzmq', 'zmq_msg_data', msg);
if not(msgptr.isNull)
    setdatatype(msgptr, 'uint8Ptr', 1, msglen);
    str = uint8(msgptr.Value);
    str = uint8([]);
err = calllib('libzmq', 'zmq_msg_close', msg);
assert(err == 0, obj.errortext('zmq_msg_close'));

[Transplant also uses zmq contexts, which are not supported in the Octave package either. Although I’m not totally sure, I think this shouldn’t be strictly needed to make it work]

Any help on this is very much appreciated!

Thanks in advance and best, Salva

reply via email to

[Prev in Thread] Current Thread [Next in Thread]