1

I have latest JeroMQ imported in Matlab and Im trying to connect to a C# program running ZeroMQ publisher.

I dont receive any messages and Im sure the publisher is sending. As it seems the socket is connected, I cant probably set socket options correctly. Any help is appreciated.

import org.zeromq.*

context = zmq.Ctx();
socket = context.createSocket(ZMQ.SUB);  

% ZMQ.SUBSCRIBE is option number 6, cant import this in matlab
socket.xsetsockopt(6, unicode2native('', 'utf8'));
socket.connect('tcp://....');

message = socket.recv(1);  % this receives empty message
message = socket.recv(0);  % this blocks and never receives
reicja
  • 88
  • 5

1 Answers1

0

The following works for me

import org.zeromq.*

context = ZMQ.context(1);
socket = context.socket(ZMQ.SUB);  
socket.subscribe('')
socket.connect('tcp://...');
socket.recvStr(0)
reicja
  • 88
  • 5
  • How does your .socket()-instance recognise, what messages it ought present as received since there was nothing subscribed to receive? Topic-filter being empty rejects all messages and receives none. Magic? Which DLL-version is actually used by the JeroMQ? – user3666197 Sep 10 '19 at 11:53