Re: [protobuf] buffer sizes when sending messages from c++ to java

2010-10-20 Thread Evan Jones
On Oct 20, 2010, at 2:13 , Kenton Varda wrote: But you are actually writing a varint32, which can be anywhere between 1 and 5 bytes depending on the value. Use CodedOutputStream::Varint32Size() to compute the number of bytes needed to encode a particular value. This has the advantage that

Re: [protobuf] buffer sizes when sending messages from c++ to java

2010-10-19 Thread Kenton Varda
On Tue, Oct 19, 2010 at 6:28 PM, Paul wrote: > int numBytesForDelim = sizeof(int); > You seem to be assuming that the delimiter is a simple fixed-width int. > coded_output->WriteVarint32(snap1.ByteSize()); > But you are actually writing a varint32, which can be anywhere between 1 and 5 bytes

Re: [protobuf] buffer sizes when sending messages from c++ to java

2010-10-19 Thread Mike Dupont
On Wed, Oct 20, 2010 at 3:28 AM, Paul wrote: > Hi, > > I am sending messages from a C++ client to a Java server, but I am > wondering about the length of the buffer I am using to send it over. > This is the C++ code: > > CLIENT SIDE CODE: > *** the protocol buffers message is called snap1 *** > >

[protobuf] buffer sizes when sending messages from c++ to java

2010-10-19 Thread Paul
Hi, I am sending messages from a C++ client to a Java server, but I am wondering about the length of the buffer I am using to send it over. This is the C++ code: CLIENT SIDE CODE: *** the protocol buffers message is called snap1 *** int numBytesForDelim = sizeof(int); char *snap_buf2; snap_buf2