hmmm, i have to use UDP in my case, TCP is not an option. On Wed, Nov 10, 2010 at 2:40 PM, Evan Jones <ev...@mit.edu> wrote: > On Nov 10, 2010, at 14:13 , Brad Lira wrote: >> >> 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. > > Just adding 1 is still probably not correct. You have similar incorrect code > on the receive side: > >> recvfrom(socket, buf, ....) >> mystr.assign(buf, strlen(buf)); > > > strlen(buf) is not going to give you the right thing. You should be using > the return value from recvfrom(), which gives you the number of bytes that > were read from the network. > > Note: If you are using UDP, it will end up not working as soon as you have a > message which is bigger than either your buffer, or the maximum UDP packet > size, whichever comes first. > > Evan > > -- > Evan Jones > http://evanjones.ca/ > >
-- 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 protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.