[protobuf] Can't read in Java message sent from C++

2010-07-10 Thread Maxim Leonovich
Few days I'm trying to send a message from C++ to Java over the network but unsuccessfully. I needed to send a several messages over one connection. I'm doing this: //C++ side void MainWindow::client_connected() { GPSChatMessage msg = GPSChatMessage();

Re: [protobuf] Can't read in Java message sent from C++

2010-07-10 Thread jamesmikedup...@googlemail.com
I encountered a similar problem with reading the bytes in C++ from data written in Java. Solved it by swapping the bytes : uint32_t magic_number = ntohl(magic_number_); http://github.com/h4ck3rm1k3/OSM-Osmosis/commit/714be97af12698f83152d2c1d0e407337e82803b mike On Sat, Jul 10, 2010 at 1:47

Re: [protobuf] Can't read in Java message sent from C++

2010-07-10 Thread Evan Jones
On Jul 10, 2010, at 7:47 , Maxim Leonovich wrote: ArrayOutputStream(buffer,msg.ByteSize() + 4,sizeof(char)); The documentation states: block_size is mainly useful for testing; in production you would probably never want to set it. So you should get rid of the sizeof(char) part.