I have implemented a simple pub/sub example. I am sending a simple hello message and trying to receive it at the subscriber. My publisher code is -
std::string msg = "hello,";
zmq::message_t message(static_cast<const void*> (msg.data()), msg.size());
publisher.send(message);
My subscriber code -
zmq::message_t msgReceive;
subscriber.recv(&msgReceive);
const char* buffer_body = static_cast<const char*>(msgReceive.data());
printf("Message: %s\n",buffer_body);
The output i am getting is - "hello,Socket-Type" instead of "hello,"
I am unable to figure out where is the mistake. Any help would be appreciated.