help-octave
[Top][All Lists]
Advanced

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

RE: Zero_mq stacked while receiving msg


From: JohnD
Subject: RE: Zero_mq stacked while receiving msg
Date: Thu, 25 Apr 2019 15:45:05 -0400


From: Ardid, Salva [mailto:address@hidden 
Sent: Thursday, April 25, 2019 12:37 PM
To: John Donoghue
Cc: address@hidden
Subject: Zero_mq stacked while receiving msg

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


--------------------------------------

Stacked ? Not sure what that means.

Note that in your malab code,  the 'zmq_msg_t' structure that is 64 bytes in 
size
That’s not the same as saying the received data will be 64 bytes in length

So just out of interest sake, try a larger zmq_recv size ... 1024 ?

Which version of libzmq are you using ?




reply via email to

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