On Thu, Sep 29, 2011 at 05:34, Dominique Volery <d.vol...@gmail.com> wrote:
> hi,
>
> i'm using gpb for a client server application. on the server is a c
> gpb library in use and on the client the messages were generated by
> java.

Which implementation do you use ? I only know the Google
implementation - so I have to
guess wrt. the C implementation. Or do you use the C++ version ?
Also, some information is missing: how do you transfer the message
between client/server ?

So this answer is mostly general but covers typical problems.

> receiving large messages on the server resolves allways in an error
> message "data too short after length-prefix of 13590511"
> small messages are not a problem. so my question is: why i have this
> problem only when client and server have different api. c client to c
> server works perfect.
> does java not set a length when the prefix WIRETYPE_LENGTH_DELIMITED
> is set? because the c server looks for the base7 coded length when
> receiving a message with this identifier.

Often a problem in C is to use strlen() or other functions that assume
that strings are \0 terminated. The protocol buffer serialization
format in general can contain any character, so this would not work.
Could there be
something like this going on ?
Also, how is your data packaged when sending over the wire?
If your data is sufficiently large, then a single read from the socket
might not return all the data you need.

In a typical client/server wire protocol, you'd transfer the length of
the serialized message in the first bytes followed by the message.
On the receiving side, you read the length and then keep reading until
you've everything you need.

Other than covering these questions, the only reliable way is to do a
debug dump of what the java service is sending and what the c service
is receiving, to see what is different.
If it is the same: manually look through the data to see how things are encoded.

Hope this helps,
  -henner

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@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.

Reply via email to