yes it was the null character, on the server side when copying buffer
into string, i had add 1 to the
size of the buffer (i guess for the null), then the parsing was ok
with no error.
On Wed, Nov 10, 2010 at 1:42 PM, Evan Jones <ev...@mit.edu> wrote:
> Brad Lira wrote:
>> strncpy(buf, mystr.c_str(), strlen(mystr.c_str()));
> strlen will return a shorter length than the real length, due to null
> characters. Use mystr.size()
>> Maybe this method is not the right way to send string across socket.
>> I tried using SerializeToFileDescriptor(socket), that worked on the
>> client side, but on the server side, i never get the message with UDP
>> is there a better way of sending data across network?
> You probably want to use TCP sockets, since it provides retransmissions for
> you. Also, you'll need to prepend a length. See:
> Or search the group archives for threads such as:
> Good luck,
> Evan Jones
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to
For more options, visit this group at