Looking for an idea to implement a network application with protobuf

Showing 1-2 of 2 messages
Looking for an idea to implement a network application with protobuf Trustin Lee 12/17/08 4:19 AM
Hi,

I'm currently trying to write a prototype client / server application
that exchanges a message which is encoded with protobuf format.  From
my understanding, it seems like a user usually defines a top level
message type that can be a container of other messages.  This approach
is called 'extension', and is described here in detail:

  * Official documentation - http://tinyurl.com/56cerv
  * Forum discussion - http://tinyurl.com/5zabns

The question is, is this the most common and efficient way to exchange
various types of messages with protobuf?  What did you do to build a
network application with many complex message types?  Is there any
alternative approach that might be used in a certain case?  I'd like
to hear your experience.

Thanks,
Trustin
Re: Looking for an idea to implement a network application with protobuf Stuart 12/17/08 4:43 AM

>
> The question is, is this the most common and efficient way to exchange
> various types of messages with protobuf?


Its very efficient, whilst keeping flexibility.  To stream it, I add 3+
bytes.

Start byte
Length byte(s)
   ProtoWrapper (which includes message type enumerator)
      ProtoMessage
End byte

Once the Length byte is read, I verify that the end byte is where it
should be before deserialising (just in case the client is sending buggy
messages, and you loose sync).

All my message types are defind in a large enumerator.  I'm hoping one
day the protobuf compiler will build that for me.

Stuart.