Re: [protobuf] Protobuf for client/server messaging?

2010-07-14 Thread Peter Keen
On Wed, Jul 14, 2010 at 1:36 AM, bwp per.mal...@gmail.com wrote:
 Our protocol consists of a big number of possible messages but I can't
 seem to find a way for protobuf to help me decide which message was
 sent.
 Writing and parsing messages is really easy when I know what exact
 message is being sent but this will never be the case in our
 application.

There's an example on the Techniques wiki page:

http://code.google.com/apis/protocolbuffers/docs/techniques.html#union

--Pete

-- 
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.



Re: [protobuf] Protobuf for client/server messaging?

2010-07-14 Thread Evan Jones

On Jul 14, 2010, at 4:36 , bwp wrote:

If we have to go down that route what would be a good identifier?


See Peter's email. But you can also use  
msg.getDescriptorForType().getFullName() to get a unique string for  
each protocol buffer message type. This is what I do for my own RPC  
system, which needs to be able to handle *any* message type (hence the  
union or extension approaches are not really correct). This needs  
the non-lite runtime, in order to have descriptors for messages. See:


http://code.google.com/apis/protocolbuffers/docs/reference/java/com/google/protobuf/Descriptors.Descriptor.html#getFullName()

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.