help-octave
[Top][All Lists]
Advanced

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

Zero_mq stacked while receiving msg


From: Ardid, Salva
Subject: Zero_mq stacked while receiving msg
Date: Thu, 25 Apr 2019 16:36:54 +0000

Unfortunately the receive function below gets stacked in Octave (i.e., when obj.isMatlab == 0 ) at the zmq_recv call and I don’t have a clue what might be wrong or how to fix it. Please note that other calls to the function seem to work fine, and then for whatever reason one of them gets trapped. I tried changing the number of bits to very large numbers with no difference. Any help is more than appreciated.

function str = receive(obj)
            if obj.isMatlab
                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);
                else
                    str = uint8([]);
                end
                err = calllib('libzmq', 'zmq_msg_close', msg);
                assert(err == 0, obj.errortext('zmq_msg_close'));
            else
                % this is all transparent in Octave (internally managed by zmq_recv)
                str = zmq_recv (obj.socket, 64, 0);
            end
        end

reply via email to

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