[zeromq-dev] Java to C++: junk appended to message?
Naveen Chawla
naveen.chwl at gmail.com
Mon Aug 30 19:29:59 CEST 2010
C++ to C++ works fine. Message is only "[Hello]"
Java to the same C++:
"[Hello═════════════════════════╠╠╠╠╠╠╠╠0x♠☺╠╠╠╠╠╠╠╠Xf♠☺╠╠╠╠^`;
ο ↕]"
(The appended junk is different every time).
Code:
Java:
public void init(){
ZMQ.Context context = ZMQ.context(1);
ZMQ.Socket socket = context.socket(ZMQ.REQ);
socket.connect("tcp://localhost:5555");
String hello = "Hello";
byte[] message = hello.getBytes();
socket.send(message, 0);
}
The C++:
int main(int argc, char** argv) {
zmq::context_t context (1);
zmq::socket_t socket (context, ZMQ_REP);
socket.bind ("tcp://*:5555");
while (true) {
zmq::message_t request;
if(socket.recv(&request, ZMQ_NOBLOCK)){
printf ("Received request: [%s]\n", (char*)request.data());
break;
}
}
return 0;
}
Bug?
Workaround?
Real or not?
All my thanks,
Nav
More information about the zeromq-dev
mailing list