ofxZmq
ofxZmq copied to clipboard
"Assertion failed: options.recv_identity" when receiving messages
Hi, I'm new to both oF and zmq. (C++ as well) In my project, I need node.js code to be connected with oF code, and I though zmq would be nice. Then I found this ofxZmq addon, and tried using it, but it didn't work well. It crashes when receiving messages (I found sending messages was no problem, though).
app.js:
var zmq = require('zmq');
pub = zmq.createSocket('pub');
pub.bind('tcp://*:5555');
setInterval(function(){
pub.send("hello");
}, 1000);
testApp.cpp:
ofxZmqSubscriber sub;
in the setup():
sub.connect("tcp://127.0.0.1:5555");
in the update():
while (sub.hasWaitingMessage())
{
ofBuffer data;
sub.getNextMessage(data);
cout << "received data: " << data << endl;
}
When running those code, oF code suddenly hangs up, saying:
Assertion failed: options.recv_identity (/Users/takuma7/code/of_v0073_osx_release/addons/ofxZmq/example/../libs/zmq/src/socket_base.cpp:990)
After some investigation I found an issue addressing that is similar to this problem here. They say the issue was fixed in libzmq v3.2.1. And the version of libzmq used in ofxZmq seems to be 3.2.0. In my case, however, both zmq are V3, so the point might be somewhere different, though similar error message to the issue arising.
But I hoppfully tried upgrading libzmq part of ofxZmq to be v3.2.1, by copy & pasting the libzmq v3.2.1 src and include folders to ofxZmq/libs/zmq/ (after running configure), but got a compilation error in ofxZmq/libs/zmq/src/msg.cpp :
zmq::msg_t::check()
saying "Expected unqualified-id", which I have no idea what this means. I try renaming this function 'checkcheck()' (awkward naming though), and replace all the 'check()' in msg.hpp, msg.cpp, trie.hpp, trie.cpp, socket_base.cpp, xsub.cpp. This removed the compilation error, and the build succeeded. However, another problem occured this time. Every received/sent message data seems to be null, not showing in console though I manage to do so.
Now I give up! I'm not sure if this is a bug, but could you just fix the bug, or tell me where I was doing wrong?