[protobuf] Size of string Message not reducing even after serializing with Protocolbuffer

2014-05-16 Thread Ratheesh R
 Hello Experts,
 
 I am new to this Protocol buffer techinque.I am trying to use PB in my 
project because my project is critical to the data transfer rate(Battery 
power).
So I am trying to use PB to serialize data (in binary mode) to reduce the 
data size before transferring this data to the other application.
But I was not successful in seeing the reduction in size even after 
serializing with API's SerializeToString() OR SerializeToArray().
 
let's  say ,my string is like the below which I am sending on evey 100 
millisecond to other application,
 
attribute msgCommand=update type=uid64 uid64=123445667898 
datatype=8 rawdata=FFF1 default=65297 /
 
Previously it was sending in text mode and now i am trying with ProtoBuff 
to serailize this to send,but I could not see any diffrence in size 
reduction of this string 
after serilaizng with PB.please see my code and let me know where i am 
doing the mistake,
 
---
proto 

message AMessage
   {
  optional string str1=1; 
   }
-
Code i have done to serailize the above string to reduce the size (binary 
format)
-
 AMessage A_msg;
 A_msg.set_str1(m_txBuff); // m_txBuff -contains the above 
mentioned string 
 std::string encode_string;
 
// tried with SerializeToString,but was not successful //
A_msg.SerializeToString(encode_string); 
 
   // --tried  with SerializeToArray ,it was also not 
successful-//
int size_bytes = A_msg.ByteSize(); 
void *buffer_bytes = malloc(size_bytes);
A_msg.SerializeToArray(buffer_bytes, size_bytes);
 
   //sending the data send 
 infomq_cmd_publish((unsigned 
char*)encode_string.c_str(),encode_string.size(),0);
 
Anything i need to do extra for making this serailization in binary format 
for reducing the size on serialization ?
 
 
 

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Re: zeromq, protobuf rpc

2014-05-16 Thread Alexandru Toader
Hello, 
I am interested in using the same setup. Has anyone found any maintained 
plugin that supports RPC over ZeroMQ?

Alex

On Tuesday, January 8, 2013 12:10:49 AM UTC+1, Mohit Jaggi wrote:

 Hi,
 According to ProtoBuf docs, the rpc service code generation is deprecated 
 and use of plugins is recommended for RPC. I am using ZeroMQ as transport 
 layer and am looking for a plugin that generates code for C/C++, Java, 
 Python. Are there any available?

 Mohit.


-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] What causes TargetInvocationException during serialization

2014-05-16 Thread Marco P.
I am trying to serialize something like this (i'll summarize as the object 
is more complex):

class Anag {

}

System.Reflection.TargetInvocationException was unhandled
  Message=TargetInvocationException
  StackTrace:
at System.Reflection.RuntimePropertyInfo.GetValue()
at ProtoBuf.Serializers.TupleSerializer.GetValue()
at ProtoBuf.Serializers.TupleSerializer.Write()
at ProtoBuf.Meta.RuntimeTypeModel.Serialize()
at ProtoBuf.ProtoWriter.WriteObject()
at 
ProtoBuf.Serializers.SubItemSerializer.ProtoBuf.Serializers.IProtoSerializer.Write()
at ProtoBuf.Serializers.TagDecorator.Write()
at ProtoBuf.Serializers.ListDecorator.Write()
at ProtoBuf.Serializers.PropertyDecorator.Write()
at ProtoBuf.Serializers.TypeSerializer.Write()
at ProtoBuf.Meta.RuntimeTypeModel.Serialize()
at ProtoBuf.Meta.TypeModel.SerializeCore()
at ProtoBuf.Meta.TypeModel.Serialize()
at ProtoBuf.Meta.TypeModel.Serialize()
at ProtoBuf.Serializer.Serialize()
 [...]
  InnerException: 

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Size of string Message not reducing even after serializing with Protocolbuffer

2014-05-16 Thread Ilia Mirkin
Can you elaborate a bit on the before scenario? (i.e. exactly what
are you comparing protobuf to?)

Protobuf adds overhead to data (in order to tell which field is which,
etc), and does nothing for reducing the sizes of strings. (Integers
are usually varint-encoded, so if they're small, they'll save space,
if they're large, they'll take up even more space than before. But you
can use fixed32/fixed64 to mitigate that if you expect large integers
to be sent.)

In your case, I would expect tag 1 varint with string length
string data. Both tag 1 and the string length should be 1 byte each,
unless the string is longer than 127 bytes (in which case the string
length would take up 2 bytes). And the string data will be however
long the passed in string is... let's say it was 50 bytes, I would
expect the protobuf-serialized message to be 52 bytes.

Does that not line up with what you're seeing?

  -ilia


On Fri, May 16, 2014 at 7:21 AM, Ratheesh R rathe.2...@gmail.com wrote:
  Hello Experts,

  I am new to this Protocol buffer techinque.I am trying to use PB in my
 project because my project is critical to the data transfer rate(Battery
 power).
 So I am trying to use PB to serialize data (in binary mode) to reduce the
 data size before transferring this data to the other application.
 But I was not successful in seeing the reduction in size even after
 serializing with API's SerializeToString() OR SerializeToArray().

 let's  say ,my string is like the below which I am sending on evey 100
 millisecond to other application,

 attribute msgCommand=update type=uid64 uid64=123445667898
 datatype=8 rawdata=FFF1 default=65297 /

 Previously it was sending in text mode and now i am trying with ProtoBuff to
 serailize this to send,but I could not see any diffrence in size reduction
 of this string
 after serilaizng with PB.please see my code and let me know where i am doing
 the mistake,

 ---
 proto
 
 message AMessage
{
   optional string str1=1;
}
 -
 Code i have done to serailize the above string to reduce the size (binary
 format)
 -
  AMessage A_msg;
  A_msg.set_str1(m_txBuff); // m_txBuff -contains the above mentioned
 string
  std::string encode_string;

 // tried with SerializeToString,but was not successful //
 A_msg.SerializeToString(encode_string);

// --tried  with SerializeToArray ,it was also not
 successful-//
 int size_bytes = A_msg.ByteSize();
 void *buffer_bytes = malloc(size_bytes);
 A_msg.SerializeToArray(buffer_bytes, size_bytes);

//sending the data send
  infomq_cmd_publish((unsigned
 char*)encode_string.c_str(),encode_string.size(),0);

 Anything i need to do extra for making this serailization in binary format
 for reducing the size on serialization ?




 --
 You received this message because you are subscribed to the Google Groups
 Protocol Buffers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to protobuf+unsubscr...@googlegroups.com.
 To post to this group, send email to protobuf@googlegroups.com.
 Visit this group at http://groups.google.com/group/protobuf.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] What causes TargetInvocationException during serialization

2014-05-16 Thread Marc Gravell
Oops, meant to reply-all!
On 16 May 2014 19:34, Marc Gravell marc.grav...@gmail.com wrote:

 This is specifically protobuf-net; I have received a repro case from Marco
 separately via email, so I will investigate and post back here and
 directly, but short version don't know off the top of my head; at first
 glance, it looks like it must be a bug in the CF-specific code of
 protobuf-net.

 Marc


 On 16 May 2014 14:58, Marco P. marco...@gmail.com wrote:

 I am trying to serialize something like this (i'll summarize as the
 object is more complex):

 class Anag {

 }

 System.Reflection.TargetInvocationException was unhandled
   Message=TargetInvocationException
   StackTrace:
 at System.Reflection.RuntimePropertyInfo.GetValue()
 at ProtoBuf.Serializers.TupleSerializer.GetValue()
 at ProtoBuf.Serializers.TupleSerializer.Write()
 at ProtoBuf.Meta.RuntimeTypeModel.Serialize()
 at ProtoBuf.ProtoWriter.WriteObject()
 at
 ProtoBuf.Serializers.SubItemSerializer.ProtoBuf.Serializers.IProtoSerializer.Write()
 at ProtoBuf.Serializers.TagDecorator.Write()
 at ProtoBuf.Serializers.ListDecorator.Write()
 at ProtoBuf.Serializers.PropertyDecorator.Write()
 at ProtoBuf.Serializers.TypeSerializer.Write()
 at ProtoBuf.Meta.RuntimeTypeModel.Serialize()
 at ProtoBuf.Meta.TypeModel.SerializeCore()
 at ProtoBuf.Meta.TypeModel.Serialize()
 at ProtoBuf.Meta.TypeModel.Serialize()
 at ProtoBuf.Serializer.Serialize()
  [...]
   InnerException:

  --
 You received this message because you are subscribed to the Google Groups
 Protocol Buffers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to protobuf+unsubscr...@googlegroups.com.
 To post to this group, send email to protobuf@googlegroups.com.
 Visit this group at http://groups.google.com/group/protobuf.
 For more options, visit https://groups.google.com/d/optout.




 --
 Regards,

 Marc


-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.