I have a below python code, which is successfully working in python - python PUB/SUB ZeroMQ ( pyzmq ) scenario.
Can I subscribe this python server through c++ ?
I added a c++ client code too, which did not work.
Python:
def send_array_and_str(socket, img, string, flags=0):
global count
print(count , " sended")
## numpy array gönderirken shape bilgilerini de msg olarak eklemek lazım
md = dict(dtype=str(img.dtype), shape=img.shape)
socket.send_string(str(count), flags | zmq.SNDMORE)
socket.send_string(string, flags | zmq.SNDMORE)
socket.send_json(md, flags | zmq.SNDMORE)
socket.send(img, flags)
count += 1
# print(count)
return
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.bind("tcp://*:5667")
C++
zmq::socket_t subscriber (context, ZMQ_SUB);
subscriber.connect("tcp://localhost:5556");
zmq::message_t update;
subscriber.recv(&update);
total_temp += temperature;