I have the following piece of code called zmq_send.cpp that sends data to a flowgraph in GNU Radio Companion via ZMQ.
#include <zmq.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <iostream>
using namespace std;
int main (void)
{
void *context = zmq_ctx_new ();
void *requester = zmq_socket (context, ZMQ_PUSH);
zmq_connect (requester, "tcp://192.168.0.243:2000");
unsigned short buffer[1];
buffer[0] = 1;
while(1)
{
cout << "Sending " << buffer[0] << endl;
zmq_send (requester, buffer, 2*1, 0);
buffer[0] = buffer[0] + 1;
sleep(1);
}
zmq_close (requester);
zmq_ctx_destroy (context);
return 0;
}
I wrote another code called zmq_recv.cpp that recieved data from the previous code:
#include <zmq.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
#include <iostream>
using namespace std;
int main (void)
{
void *context = zmq_ctx_new ();
void *responder = zmq_socket (context, ZMQ_PULL);
int rc = zmq_bind (responder, "tcp://192.168.0.243:2000");
assert (rc == 0);
unsigned short buffer [1];
while (1) {
zmq_recv (responder, buffer, 2*1, 0);
cout << buffer[0];
cout << endl;
sleep (1);
}
return 0;
}
When I send data between these codes, the data is sent successfully from the sender to the receiver. However, if I try to send data from zmq_send.cpp to GNU Radio Companion, the data is not received in the grc file. No data is seen in the time sink and no data is saved in the file.
Can anyone please explain to me why gnuradio is not receiving data from the sender?