Minimum lenght of request
Hello everyone,
I am trying out 0mq for Python <-> C++ IPC. What is interesting, whenever I send a request shorter than 5 characters from Python client to C++ server I get interesting result:
H+t
instead of just
H
But if I have at least 5 characters the message is parsed correctly… For Hello and longer I get what I send.
I don't define the buffer length anywhere so I am wondering.
In C++ server code looks like:
zmq::message_t request;
// Wait for next request from client
socket_.recv (&request);
std::istringstream iss(static_cast<char*>(request.data()));
std::string message;
iss >> message;
std::cout << "Received " << message << std::endl; // here I get strange output!
// Do some 'work'
sleep(1);
// Send reply back to client
...
and Python
print("Sending request to C++")
self.socket.send_string("H")
# Get the reply.
message = self.socket.recv()
print("Received reply [ {} ]".format(message.decode('utf-8')))
all the code is taking from the examples hwserver and hwclient
If I send short message from C++ to Python it is parsed correctly though… Interesting.
I am sending long messages so actually it shouldn't be that terrible atm, but it may become problematic at some point.
Thank you for any insight!