Archived
This forum has been archived. Please start a new discussion on GitHub.
any way to know how much bytes used for object serialization?
mathgl
in Help Center
Hi All..
I have a question about the size of object. As we know all objects before being sent to lan need to map to a sequence of bytes, Do you have any way to know how much bytes an object does occupy. I want to know this number for testing purpose....
I have a question about the size of object. As we know all objects before being sent to lan need to map to a sequence of bytes, Do you have any way to know how much bytes an object does occupy. I want to know this number for testing purpose....
0
Comments
-
Hi,
You can get the size of a request using protocol tracing by setting Ice.Trace.Protocol=1. Another option is to marshal the object into a byte sequence using the Ice streaming API and measure the size of the byte sequence.
Cheers,
Benoit.0 -
Hi Benoit
Thanks for your reply. After checking chapter 36.2, i used slice2cs with --stream to generate the .ice file again for serialization purpose. however when i checked the generated file i found a piece of codes like:
public override void write__(Ice.OutputStream outS__)
{
Ice.MarshalException ex = new Ice.MarshalException();
ex.reason = "type RoundTech::TTianHeInstantMessage was not generated with stream support";
throw ex;
}
Could you please give me a guide how to let a type support stream?
Thanks.0 -
benoit wrote: »Hi,
Which Ice version do you use and on which platform? This should work. With Ice 3.4.0, you can try out the C# Ice/invoke demo for an example on how to marshall various Slice structures with the Ice streaming API.
Cheers,
Benoit.
Hi Benoit
i want to know another thing about sequence type. In my ice file i have two definitions for sequence<string>. I show the code as follow:
sequence<string> StringArrayType;
["clr:generic:List"]
sequence<string> StringListType;
this file works perfect without --stream. When i try to use the generated .cs file which is compiled with --stream. The compiler comlains there are no proper overload methods for StringSeqHelper outputstream/inputstream.
If i drop down one of them, now it works again with --stream. Do you have any idea about that??
Thanks..0
