[Mono-list] Binary serialization

Lluis Sanchez lsg@ctv.es
Fri, 17 Jan 2003 15:29:31 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_0103_01C2BE3D.3B2AAC10
Content-Type: multipart/alternative;
	boundary="----=_NextPart_001_0104_01C2BE3D.3B2AAC10"


------=_NextPart_001_0104_01C2BE3D.3B2AAC10
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello!,

I've just commited the implementation of BinaryFormatter and other =
support classes. Now Mono has support for binary serialization!!

The format is based on the analysis of the output of the BinaryFormatter =
of the Microsoft .NET runtime, so it is probably not complete, since I =
cannot be sure that I have tested all cases (but I think it must be 90% =
complete).

I've attached a document that describes the format. There are some gaps =
in some tables of codes, so if you find a meaning for the missing codes, =
please contact me and I'll update the document.

However, it does not mean that mono serialization is fully compatible =
with microsoft's runtime. Although the format is the same, objects may =
have a different internal structure. For example, mono's ArrayList =
stores elements in an object array named dataArray, while in MS runtime, =
it is named _items. An ArrayList serialized using mono is currently not =
deserializable with MS and vice-versa. I think it happens the same with =
many other classes, and changing all of them may be a lot of work.

Another difference is how primitive types are serialized. I've noticed =
that MS uses the codes of the enum TypeCode to identify primitive types. =
I did the same, but the codes of mono's TypeCode enum are different, so =
the formatter gets confused when reading values of an object serialized =
with MS runtime. I've also seen that decimal values are serialized using =
a different format. However, this should be easy to solve.

Now, I'll try to plug this into Remoting ;-)

Enjoy,

Lluis.

------=_NextPart_001_0104_01C2BE3D.3B2AAC10
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1126" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello!,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I've just commited the implementation =
of=20
BinaryFormatter and other support classes. Now Mono has support for =
binary=20
serialization!!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The format is based on the analysis of =
the output=20
of the BinaryFormatter&nbsp;of the Microsoft .NET runtime, so it is =
probably not=20
complete, since I cannot be sure that I have tested all cases (but I =
think it=20
must be 90% complete).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I've attached a document that describes =
the format.=20
</FONT><FONT face=3DArial size=3D2>There are some gaps in some tables of =
codes, so=20
if you find a meaning for the missing codes, please contact me and I'll =
update=20
the document.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>However, it does not mean that mono =
serialization=20
is fully compatible with microsoft's runtime.&nbsp;Although the format =
is the=20
same, objects may have a different internal structure. For example, =
mono's=20
ArrayList stores elements in an object array named dataArray, while in =
MS=20
runtime, it is named _items. An ArrayList serialized using mono&nbsp;is=20
currently not&nbsp;deserializable with MS and vice-versa. I think it =
happens the=20
same with many other classes, and changing all of them may be a lot of=20
work.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Another difference is how primitive =
types are=20
serialized. I've noticed that MS uses&nbsp;the codes of the enum =
TypeCode to=20
identify primitive types. I did the same, but the codes of mono's =
TypeCode enum=20
are different, so the formatter gets confused when reading values of an =
object=20
serialized with MS runtime. I've also seen that decimal values are =
serialized=20
using a different format. However, this should be easy to =
solve.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Now, I'll try to plug this into =
Remoting=20
;-)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Enjoy,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Lluis.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_001_0104_01C2BE3D.3B2AAC10--

------=_NextPart_000_0103_01C2BE3D.3B2AAC10
Content-Type: text/html;
	name="binary serialization format.htm"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="binary serialization format.htm"

<html>
	<head>
		<title>Binary Serialization Format</title>
		<style> body { FONT-SIZE: x-small; FONT-FAMILY: arial }
	table { FONT-SIZE: x-small; FONT-FAMILY: arial }
	</style>
	</head>
	<body>
		<H1>Binary Serialization Format</H1>
		<P>by Lluis Sanchez Gual&nbsp;(<A =
href=3D"mailto:lluis@ideary.com">lluis@ideary.com</A>)</P>
		<UL>
			<LI>
				<A href=3D"#intro">Introduction</A>
			<LI>
				<A href=3D"#format">Format description</A>
				<UL>
					<LI>
						<A href=3D"#example">An example</A></LI></UL>
			<LI>
				<A href=3D"#elements">Binary elements</A>
				<UL>
					<LI>
						<A href=3D"#elem1">1 - RefTypeObject</A>
					<LI>
						<A href=3D"#elem4">4 - RuntimeObject</A>
					<LI>
						<A href=3D"#elem5">5 - ExternalObject</A>
					<LI>
						<A href=3D"#elem6">6 - String</A>
					<LI>
						<A href=3D"#elem7">7 - GenericArray</A>
					<LI>
						<A href=3D"#elem8">8 - BoxedPrimitiveTypeValue</A>
					<LI>
						<A href=3D"#elem9">9 - ObjectReference</A>
					<LI>
						<A href=3D"#elem10">10 - NullValue</A>
					<LI>
						<A href=3D"#elem11">11 - End</A>
					<LI>
						<A href=3D"#elem12">12 - Assembly</A>
					<LI>
						<A href=3D"#elem13">13 - ArrayFiller8b</A>
					<LI>
						<A href=3D"#elem14">14 - ArrayFiller32b</A>
					<LI>
						<A href=3D"#elem15">15 - ArrayOfPrimitiveType</A>
					<LI>
						<A href=3D"#elem16">16 - ArrayOfObject</A>
					<LI>
						<A href=3D"#elem17">17 - ArrayOfString</A>
					<LI>
						<A href=3D"#elem21">21 - MethodCall</A>
					<LI>
						<A href=3D"#elem22">22 - MethodResponse</A></LI></UL>
			<LI>
				<A href=3D"#other">Other Elements</A>
				<UL>
					<LI>
						<A href=3D"#string">string</A>
					<LI>
						<A href=3D"#primitive-value">primitive-value</A>
					<LI>
						<A href=3D"#value">value</A>
					<LI>
						<A href=3D"#type-tag">type-tag</A>
					<LI>
						<A href=3D"#type-spec">type-spec</A>
					<LI>
						<A href=3D"#method-call-flags">method-call-flags</A>
					<LI>
						<A href=3D"#method-response-flags">method-response-flags</A>
					<LI>
						<A href=3D"#return-type-tag">return-type-tag</A></LI></UL>
			</LI>
		</UL>
		<a name=3D"intro"></a>
		<H2>Introduction</H2>
		<P>This document describes the format used by the class =
BinaryFormatter to=20
			serialize object graphs. The document is based on the analysis of the =
output of=20
			the BinaryFormatter&nbsp;of the Microsoft .NET runtime, so it is =
probably not=20
			complete, since I cannot be sure that I have tested all cases. In =
fact, there=20
			are some gaps in some tables of codes, so if you find a meaning for =
the missing=20
			codes, please contact me and I'll update the document.</P>
		<a name=3D"format"></a>
		<H2>Format description</H2>
		<P>An object serialization is a sequence of binary elements.&nbsp;A =
binary element=20
			coluld be for example a description of an object, an array, an =
assembly, etc.=20
			Each binary element has a specific format, which is described in the =
following=20
			sections.</P>
		<P>This table shows the available binary elements:</P>
		<P>
			<TABLE id=3D"Table1" style=3D"WIDTH: 560px; HEIGHT: 94px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"560" border=3D"1">
				<TR>
					<TD width=3D"40"><STRONG>Code</STRONG></TD>
					<TD><STRONG>Label</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"40">0</TD>
					<TD>Header</TD>
					<TD>Allways written at the beggining of a serialization</TD>
				</TR>
				<TR>
					<TD width=3D"40">1</TD>
					<TD><A href=3D"#elem1">RefTypeObject</A></TD>
					<TD>Object with no type metadata</TD>
				</TR>
				<TR>
					<TD width=3D"40">4</TD>
					<TD><A href=3D"#elem4">RuntimeObject</A></TD>
					<TD>Corlib object</TD>
				</TR>
				<TR>
					<TD width=3D"40">5</TD>
					<TD><A href=3D"#elem5">ExternalObject</A></TD>
					<TD>Object</TD>
				</TR>
				<TR>
					<TD width=3D"40">6</TD>
					<TD><A href=3D"#elem6">String</A></TD>
					<TD>String</TD>
				</TR>
				<TR>
					<TD width=3D"40">7</TD>
					<TD><A href=3D"#elem7">GenericArray</A></TD>
					<TD>Array</TD>
				</TR>
				<TR>
					<TD width=3D"40">8</TD>
					<TD><A href=3D"#elem8">BoxedPrimitiveTypeValue</A></TD>
					<TD>Primitive type value</TD>
				</TR>
				<TR>
					<TD width=3D"40">9</TD>
					<TD><A href=3D"#elem9">ObjectReference</A></TD>
					<TD>Object reference</TD>
				</TR>
				<TR>
					<TD width=3D"40">10</TD>
					<TD><A href=3D"#elem10">NullValue</A></TD>
					<TD>Null value</TD>
				</TR>
				<TR>
					<TD width=3D"40">11</TD>
					<TD><A href=3D"#elem11">End</A></TD>
					<TD>End of stream</TD>
				</TR>
				<TR>
					<TD width=3D"40">12</TD>
					<TD><A href=3D"#elem12">Assembly</A></TD>
					<TD>Assembly declaration</TD>
				</TR>
				<TR>
					<TD width=3D"40">13</TD>
					<TD><A href=3D"#elem13">ArrayFiller8b</A></TD>
					<TD>Null filler (8 bit length)</TD>
				</TR>
				<TR>
					<TD width=3D"40">14</TD>
					<TD><A href=3D"#elem14">ArrayFiller32b</A></TD>
					<TD>Null filler (16 bit length)</TD>
				</TR>
				<TR>
					<TD width=3D"40">15</TD>
					<TD><A href=3D"#elem15">ArrayOfPrimitiveType</A></TD>
					<TD>Array of primitive type</TD>
				</TR>
				<TR>
					<TD width=3D"40">16</TD>
					<TD><A href=3D"#elem16">ArrayOfObject</A></TD>
					<TD>Array of Object</TD>
				</TR>
				<TR>
					<TD width=3D"40">17</TD>
					<TD><A href=3D"#elem17">ArrayOfString</A></TD>
					<TD>Array of string</TD>
				</TR>
				<TR>
					<TD width=3D"40">21</TD>
					<TD><A href=3D"#elem21">MethodCall</A></TD>
					<TD>Method call</TD>
				</TR>
				<TR>
					<TD width=3D"40">22</TD>
					<TD><A href=3D"#elem22">MethodResponse</A></TD>
					<TD>Method response</TD>
				</TR>
			</TABLE>
		</P>
		<P>All elements begin with a byte that identifies the type of element. =
It is shown=20
			in the "Code" column. In the implementation of the formatter I use an =
enum to=20
			represent those codes. The "Label" column is the name of the =
corresponding enum=20
			element.</P>
		<a name=3D"example"></a>
		<H3>An example</H3>
		<P>The best way to underestand the format is to look at an example. =
Let's see how=20
			the following structure of classes would be serialized:</P>
		<BLOCKQUOTE dir=3D"ltr" style=3D"MARGIN-RIGHT: 0px">
			<P><FONT face=3D"Courier New">class A<BR>
					{<BR>
					&nbsp;&nbsp;&nbsp;&nbsp; B bval =3D new B();<BR>
					&nbsp;&nbsp;&nbsp;&nbsp; C cval =3D new C();<BR>
					&nbsp;&nbsp;&nbsp;&nbsp; string msg =3D "hello";<BR>
					}<BR>
					<BR>
					class B<BR>
					{<BR>
					&nbsp;&nbsp;&nbsp;&nbsp; string str =3D "bye";<BR>
					}<BR>
					<BR>
					struct C<BR>
					{<BR>
					&nbsp;&nbsp;&nbsp;&nbsp; string[] info =3D new string[] =
{"hello","world"}<BR>
					}</FONT></P>
		</BLOCKQUOTE>
		<P>The serialization of an instance of class A would result in a =
sequence of binary=20
			elements like the following:</P>
		<P>
			<TABLE id=3D"Table35" cellSpacing=3D"1" cellPadding=3D"1" =
width=3D"100%" border=3D"1">
				<TR>
					<TD vAlign=3D"top" width=3D"169"><STRONG>Element</STRONG></TD>
					<TD vAlign=3D"top" width=3D"40"><STRONG>Bytes</STRONG></TD>
					<TD vAlign=3D"top" width=3D"186"><STRONG>Data</STRONG></TD>
					<TD vAlign=3D"top"><STRONG>Comments</STRONG></TD>
				</TR>
				<TR>
					<TD vAlign=3D"top" width=3D"169">Header</TD>
					<TD vAlign=3D"top" width=3D"40">0<BR>
						1,0,0,0,<BR>
						255,255,255,255,<BR>
						1,0,0,0,0,0,0,0</TD>
					<TD vAlign=3D"top" width=3D"186">Element code ?</TD>
					<TD vAlign=3D"top">This sequence of bytes is serialized at the =
beginning. I'm sure it=20
						has a meaning, but I don't know it.</TD>
				</TR>
				<TR>
					<TD vAlign=3D"top" width=3D"169"><A =
href=3D"#elem12">Assembly</A></TD>
					<TD vAlign=3D"top" width=3D"40">1<BR>
						1,0,0,0<BR>
						"MyAssembly"</TD>
					<TD vAlign=3D"top" width=3D"186">Element code<BR>
						ID of the assembly (1)<BR>
						Full name of the assembly</TD>
					<TD vAlign=3D"top">
						<P>Before serializing an object, the assembly where the object is =
implemented has=20
							to be serialized. The formatter assigns an ID to the assembly (ID =
1 in this=20
							case). This ID will by used to refer to this assembly.</P>
					</TD>
				</TR>
				<TR>
					<TD vAlign=3D"top" width=3D"169"><A =
href=3D"#elem5">ExternalObject</A></TD>
					<TD vAlign=3D"top" width=3D"40">5<BR>
						2,0,0,0<BR>
						"A"<BR>
						3,0,0,0<BR>
						"bval","cval","msg"<BR>
						4,4,1<BR>
						"B"<BR>
						1,0,0,0<BR>
						"C"<BR>
						1,0,0,0<BR>
						1,0,0,0</TD>
					<TD vAlign=3D"top" width=3D"186">Element code<BR>
						Object ID (2)<BR>
						Class name<BR>
						Field count<BR>
						Field names<BR>
						Field type tags<BR>
						Class name of field "bval"<BR>
						Assembly ID of field "bval"<BR>
						Class name of field "cval"<BR>
						Assembly ID of field "cval"<BR>
						Assembly ID of this object</TD>
					<TD vAlign=3D"top">Serialization of the root object. Each object =
has an ID that is=20
						used, for example, to specify object relations. The object binary =
element has=20
						two parts. The first one is type metadata: the name and type of =
serialized=20
						fields. The second part is the object data: field values. The data =
part is=20
						shown in the following nested elements.</TD>
				</TR>
				<TR>
					<TD vAlign=3D"top" =
width=3D"169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A =
href=3D"#elem9">ObjectReference</A></TD>
					<TD vAlign=3D"top" width=3D"40">9<BR>
						5,0,0,0</TD>
					<TD vAlign=3D"top" width=3D"186">Element code<BR>
						ID of the referred object (5)</TD>
					<TD vAlign=3D"top">Reference objects are not serialized inside the =
container element.=20
						Instead, an ObjectReference is serialized, and the object itself =
queued for=20
						later serialization.</TD>
				</TR>
				<TR>
					<TD vAlign=3D"top" =
width=3D"169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A =
href=3D"#elem5">ExternalObject</A></TD>
					<TD vAlign=3D"top" width=3D"40">5<BR>
						3,0,0,0<BR>
						C<BR>
						1,0,0,0<BR>
						"info"<BR>
						6<BR>
						1,0,0,0</TD>
					<TD vAlign=3D"top" width=3D"186">Element code<BR>
						Object ID (3)<BR>
						Class name<BR>
						Field count<BR>
						Field name<BR>
						Field type tag<BR>
						Assembly ID of this object</TD>
					<TD vAlign=3D"top">On the other hand, value type objects are =
serialized inside the=20
						container element.</TD>
				</TR>
				<TR>
					<TD vAlign=3D"top" =
width=3D"169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;
						<A href=3D"#elem9">ObjectReference</A></TD>
					<TD vAlign=3D"top" width=3D"40">9<BR>
						7,0,0,0</TD>
					<TD vAlign=3D"top" width=3D"186">Element code<BR>
						ID of the referred object (7)</TD>
					<TD vAlign=3D"top">This is again a reference object, so it is =
serialized later.</TD>
				</TR>
				<TR>
					<TD vAlign=3D"top" =
width=3D"169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A =
href=3D"#elem6">String</A></TD>
					<TD vAlign=3D"top" width=3D"40">6<BR>
						4,0,0,0<BR>
						"hello"</TD>
					<TD vAlign=3D"top" width=3D"186">Element code<BR>
						Object ID (4)<BR>
						String value</TD>
					<TD vAlign=3D"top">Strings are serialized like value objects</TD>
				</TR>
				<TR>
					<TD vAlign=3D"top" width=3D"169"><A =
href=3D"#elem5">ExternalObject</A></TD>
					<TD vAlign=3D"top" width=3D"40">5<BR>
						5,0,0,0<BR>
						"B"<BR>
						1,0,0,0<BR>
						"str"<BR>
						1<BR>
						1,0,0,0</TD>
					<TD vAlign=3D"top" width=3D"186">Element code<BR>
						Object ID (5)<BR>
						Class name<BR>
						Field count<BR>
						Field name<BR>
						Field type tag<BR>
						Assembly ID of this object</TD>
					<TD vAlign=3D"top">
						<P>Reference objects queued for serialization are serialized after =
the root object.</P>
					</TD>
				</TR>
				<TR>
					<TD vAlign=3D"top" =
width=3D"169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A =
href=3D"#elem6">String</A></TD>
					<TD vAlign=3D"top" width=3D"40">6<BR>
						6,0,0,0<BR>
						"bye"</TD>
					<TD vAlign=3D"top" width=3D"186">Element code<BR>
						Object ID (6)<BR>
						String value</TD>
					<TD vAlign=3D"top">A string</TD>
				</TR>
				<TR>
					<TD vAlign=3D"top" width=3D"169"><A =
href=3D"#elem17">ArrayOfString</A></TD>
					<TD vAlign=3D"top" width=3D"40">17<BR>
						7,0,0,0<BR>
						2,0,0,0</TD>
					<TD vAlign=3D"top" width=3D"186">Element code<BR>
						Object ID (7)<BR>
						Element count</TD>
					<TD vAlign=3D"top">This could be also encoded using the =
binary&nbsp;element Array=20
						(7), but ArrayOfString is more specific and saves bytes.</TD>
				</TR>
				<TR>
					<TD vAlign=3D"top" =
width=3D"169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A =
href=3D"#elem9">ObjectReference</A></TD>
					<TD vAlign=3D"top" width=3D"40">9<BR>
						4,0,0,0</TD>
					<TD vAlign=3D"top" width=3D"186">Element code<BR>
						ID of the referred object (4)</TD>
					<TD vAlign=3D"top">This string was already serialized. Use a =
backwards reference.</TD>
				</TR>
				<TR>
					<TD vAlign=3D"top" =
width=3D"169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A =
href=3D"#elem6">String</A></TD>
					<TD vAlign=3D"top" width=3D"40">6<BR>
						8,0,0,0<BR>
						"world"</TD>
					<TD vAlign=3D"top" width=3D"186">Element code<BR>
						Object ID (8)<BR>
						String value</TD>
					<TD vAlign=3D"top">Another string</TD>
				</TR>
			</TABLE>
		</P>
		<a name=3D"elements"></a>
		<H2>Binary elements</H2>
		<P>The following sections show the format of each binary element. The =
format is=20
			presented in a table with two columns. The first one shows the =
sequence of=20
			bytes and the second one a description of each element in the =
sequence.</P>
		<P>A special notation is used to represent the bytes. Here are some =
examples:</P>
		<P>
			<TABLE id=3D"Table36" style=3D"WIDTH: 448px; HEIGHT: 129px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"448" border=3D"1">
				<TR>
					<TD width=3D"193"><STRONG>Example of element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"193">(byte) 7</TD>
					<TD>A single byte</TD>
				</TR>
				<TR>
					<TD width=3D"193">uint</TD>
					<TD>Any uint value (4 bytes)</TD>
				</TR>
				<TR>
					<TD width=3D"193"><EM><A href=3D"#type-tag">type-tag</A></EM></TD>
					<TD>Names&nbsp;in italic are described in the section "Other =
elements"</TD>
				</TR>
				<TR>
					<TD width=3D"193"><EM><A =
href=3D"#string">string</A></EM>&nbsp;*</TD>
					<TD>* represents a sequence of elements</TD>
				</TR>
				<TR>
					<TD width=3D"193">object</TD>
					<TD>Full serialization of an object</TD>
				</TR>
			</TABLE>
		</P>
		<a name=3D"elem1"></a>
		<H3>1 - RefTypeObject
		</H3>
		<P>An object is serialized in two parts. The first one is type =
metadata, and the=20
			second one is the object data. When several objects of the same type =
are=20
			serialized, only the first one has the metadata part. The other =
objects are=20
			serialized using the RefTypeObject element, which instead of the =
metadata, it=20
			includes an ID of an object that is of the same type as the one being =

			serialized.</P>
		<P>
			<TABLE id=3D"Table2" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"142"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"142">(byte) 1</TD>
					<TD>Element code</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>Object ID</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>ID of a previously serialized object from which to take type =
metadata.</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A href=3D"#value">value</A> </EM>*</TD>
					<TD>Values of the fields of the object</TD>
				</TR>
			</TABLE>
		</P>
		<a name=3D"elem4"></a>
		<H3>4 - RuntimeObject</H3>
		<P>This element is used to serialize objects of types that are =
implemented in the=20
			core library of the framework. The only difference from the format =
for other=20
			objects if that it does not include assembly information, which is =
not needed=20
			since the assembly will always be mscorlib.</P>
		<P>
			<TABLE id=3D"Table21" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"142"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"142">(byte) 4</TD>
					<TD>Element code</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>Object ID</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A href=3D"#string">string</A></EM></TD>
					<TD>Class name, including namespace</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>Number of serialized fields</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A href=3D"#string">string</A> </EM>*</TD>
					<TD>Names of the fields</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A href=3D"#type-tag">type-tag</A> =
*</EM></TD>
					<TD>type-tag of each field</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A href=3D"#type-spec">type-spec</A> =
*</EM></TD>
					<TD>type-spec of each field</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A href=3D"#value">value</A> *</EM></TD>
					<TD>Values of the fields of the object</TD>
				</TR>
			</TABLE>
		</P>
		<a name=3D"elem5"></a>
		<H3>5 - ExternalObject</H3>
		<P>This element can be used to serialize any object from any =
assembly.</P>
		<H3>
			<TABLE id=3D"Table22" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"142"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"142">(byte) 5</TD>
					<TD>Element code</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>Object ID</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A href=3D"#string">string</A></EM></TD>
					<TD>Class name, including namespace</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>Number of serialized fields</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A href=3D"#string">string</A> </EM>*</TD>
					<TD>Names of the fields</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A href=3D"#type-tag">type-tag</A> =
</EM>*</TD>
					<TD>type-tag of each field</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A href=3D"#type-spec">type-spec</A> =
</EM>*</TD>
					<TD>type-spec of each field</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>ID of the assembly where the class is defined (the assembly =
must have been=20
						serialized before the class using the binary element 12)</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A href=3D"#value">value</A> </EM>*</TD>
					<TD>Values of the fields of the object</TD>
				</TR>
			</TABLE>
		</H3>
		<a name=3D"elem6"></a>
		<H3>6 - String</H3>
		<P>A string value.</P>
		<P>
			<TABLE id=3D"Table23" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"142"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"142">(byte) 6</TD>
					<TD>Element code</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>Object ID</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A href=3D"#string">string</A></EM></TD>
					<TD>Value of the string</TD>
				</TR>
			</TABLE>
		</P>
		<a name=3D"elem7"></a>
		<H3>7 - GenericArray</H3>
		<P>This element can be used to represent any array.</P>
		<H3>
			<TABLE id=3D"Table24" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"142"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"142">(byte) 7</TD>
					<TD>Element code</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>Object ID</TD>
				</TR>
				<TR>
					<TD width=3D"142">byte</TD>
					<TD>Array type: 0:single dimension, 1: jagged, 2: =
multi-dimensional</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>Number of dimensions (rank)</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint *</TD>
					<TD>Number of&nbsp;elements for each dimension</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A href=3D"#type-tag">type-tag</A></EM></TD>
					<TD>type-tag of array's&nbsp;element type</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A =
href=3D"#type-spec">type-spec</A></EM></TD>
					<TD>type-spec of array's&nbsp;element type</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A href=3D"#value">value</A> *</EM></TD>
					<TD>Values of the elements, row by row</TD>
				</TR>
			</TABLE>
		</H3>
		<a name=3D"elem8"></a>
		<H3>8 - BoxedPrimitiveTypeValue</H3>
		<P>This element represents a primitive type value boxed as an =
object.</P>
		<P>
			<TABLE id=3D"Table25" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"142"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"142">(byte) 8</TD>
					<TD>Element code</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A =
href=3D"#type-spec">type-spec</A></EM></TD>
					<TD>type-spec of the primitive type</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A =
href=3D"#primitive-value">primitive-value</A></EM></TD>
					<TD>Raw value</TD>
				</TR>
			</TABLE>
		</P>
		<a name=3D"elem9"></a>
		<H3>9 - ObjectReference</H3>
		<P>This element represents a reference to an object already serialized =
(backwards=20
			reference) or that will be serialized later (forward reference).
		</P>
		<P>
			<TABLE id=3D"Table26" style=3D"WIDTH: 568px; HEIGHT: 16px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"142"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"142">(byte) 9</TD>
					<TD>Element code</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>ID of the referred object</TD>
				</TR>
			</TABLE>
		</P>
		<a name=3D"elem10"></a>
		<H3>10 - NullValue</H3>
		<P>A&nbsp;null value.</P>
		<TABLE id=3D"Table27" style=3D"WIDTH: 568px; HEIGHT: 16px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
			<TR>
				<TD width=3D"142"><STRONG>Element</STRONG></TD>
				<TD><STRONG>Description</STRONG></TD>
			</TR>
			<TR>
				<TD width=3D"142">(byte) 10</TD>
				<TD>Element code</TD>
			</TR>
		</TABLE>
		<P></P>
		<a name=3D"elem11"></a>
		<H3>
			<P>11 - End</P>
		</H3>
		<P>This element marks the end of the serialized object graph.</P>
		<TABLE id=3D"Table28" style=3D"WIDTH: 568px; HEIGHT: 16px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
			<TR>
				<TD width=3D"142"><STRONG>Element</STRONG></TD>
				<TD><STRONG>Description</STRONG></TD>
			</TR>
			<TR>
				<TD width=3D"142">(byte) 11</TD>
				<TD>Element code</TD>
			</TR>
		</TABLE>
		<a name=3D"elem12"></a>
		<H3>
			<P>12 - Assembly</P>
		</H3>
		<P>Defines an assembly. Each assembly is defined only once and has an =
ID. This ID=20
			is used when serializing an object (element 5) to specify the =
assembly where=20
			object's type is implemented.</P>
		<TABLE id=3D"Table29" style=3D"WIDTH: 568px; HEIGHT: 16px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
			<TR>
				<TD width=3D"142"><STRONG>Element</STRONG></TD>
				<TD><STRONG>Description</STRONG></TD>
			</TR>
			<TR>
				<TD width=3D"142">(byte) 12</TD>
				<TD>Element code</TD>
			</TR>
			<TR>
				<TD width=3D"142">uint</TD>
				<TD>Assembly ID</TD>
			</TR>
			<TR>
				<TD width=3D"142"><EM><A href=3D"#string">string</A></EM></TD>
				<TD>Full name of the assembly</TD>
			</TR>
		</TABLE>
		<a name=3D"elem13"></a>
		<H3>
			<P>13 - ArrayFiller8b</P>
		</H3>
		<P>This element can be used when serializing array data to specify =
multiple=20
			consecutive null values. It it only used in single dimension arrays =
of=20
			reference objects (not valid for value-type objects).</P>
		<TABLE id=3D"Table30" style=3D"WIDTH: 568px; HEIGHT: 16px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
			<TR>
				<TD width=3D"142"><STRONG>Element</STRONG></TD>
				<TD><STRONG>Description</STRONG></TD>
			</TR>
			<TR>
				<TD width=3D"142">(byte) 13</TD>
				<TD>Element code</TD>
			</TR>
			<TR>
				<TD width=3D"142">byte</TD>
				<TD>Number of consecutive null values</TD>
			</TR>
		</TABLE>
		<P></P>
		<a name=3D"elem14"></a>
		<H3>
			<P>14 - ArrayFiller32b</P>
		</H3>
		<P>The same as ArrayFiller8b, but it uses a uint to specify the =
length.</P>
		<TABLE id=3D"Table31" style=3D"WIDTH: 568px; HEIGHT: 16px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
			<TR>
				<TD width=3D"142"><STRONG>Element</STRONG></TD>
				<TD><STRONG>Description</STRONG></TD>
			</TR>
			<TR>
				<TD width=3D"142">(byte) 14</TD>
				<TD>Element code</TD>
			</TR>
			<TR>
				<TD width=3D"142">uint</TD>
				<TD>Number of consecutive null values</TD>
			</TR>
		</TABLE>
		<P></P>
		<a name=3D"elem15"></a>
		<H3>
			<P>15 - ArrayOfPrimitiveType</P>
		</H3>
		<P>This element can be used to represent a single dimension array of =
primitive type=20
			values.</P>
		<P>
			<TABLE id=3D"Table32" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"142"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"142">(byte) 15</TD>
					<TD>Element code</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>Object ID</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>Number of&nbsp;elements</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A =
href=3D"#type-spec">type-spec</A></EM></TD>
					<TD>type-spec of array's&nbsp;element type</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><A =
href=3D"#primitive-value">primitie-value</A> *</EM></TD>
					<TD>Values of the elements</TD>
				</TR>
			</TABLE>
		</P>
		<a name=3D"elem16"></a>
		<H3>16&nbsp;- ArrayOfObject</H3>
		<P>This element can be used to represent a single dimension array of =
Object (i.e.=20
			an object[] ).</P>
		<P>
			<TABLE id=3D"Table33" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"142"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"142">(byte) 16</TD>
					<TD>Element code</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>Object ID</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>Number of&nbsp;elements</TD>
				</TR>
				<TR>
					<TD width=3D"142">object *</TD>
					<TD>Values of the elements</TD>
				</TR>
			</TABLE>
		</P>
		<a name=3D"elem17"></a>
		<H3>17 - ArrayOfString</H3>
		<P>This element can be used to represent a single dimension array =
of&nbsp;String=20
			(i.e. an string[] ).</P>
		<P>
			<TABLE id=3D"Table34" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"142"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"142">(byte) 17</TD>
					<TD>Element code</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>Object ID</TD>
				</TR>
				<TR>
					<TD width=3D"142">uint</TD>
					<TD>Number of&nbsp;elements</TD>
				</TR>
				<TR>
					<TD width=3D"142">object *</TD>
					<TD>Values of the elements</TD>
				</TR>
			</TABLE>
		</P>
		<a name=3D"elem21"></a>
		<H3>21 Method call</H3>
		<P>Represents a method call. The format of a method call can vary =
depending on the=20
			type of the parameters.&nbsp;The following&nbsp;table shows the =
common format:</P>
		<P>
			<TABLE id=3D"Table20" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"142"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"142">(byte) 21</TD>
					<TD>Element code</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM>method-call-flags</EM></TD>
					<TD>Describes wich information includes the method call</TD>
				</TR>
				<TR>
					<TD width=3D"142">(byte) 0, 0, 0</TD>
					<TD>???</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><EM><A href=3D"#type-spec">type-spec</A><BR>
								<EM><A =
href=3D"#primitive-value">primitive-value</A></EM></EM></EM></TD>
					<TD>Method name</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM><EM><EM><A =
href=3D"#type-spec">type-spec</A><BR>
									<EM><A =
href=3D"#primitive-value">primitive-value</A></EM></EM></EM></EM></TD>
					<TD>Class name (including namespace and assembly)</TD>
				</TR>
			</TABLE>
		</P>
		<P>The following tables describe the format of the message content =
depending on the=20
			value of method-call-flags:</P>
		<H4>method-call-flags &amp; NoArguments</H4>
		<P>Used for calls to methods without parameters.</P>
		<H4>
			<TABLE id=3D"Table8" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"119"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"119">object[]</TD>
					<TD>
						<P>Only&nbsp;if method-response-flags has the flag =
<EM>IncludeLogicalCallContext</EM>.=20
							In this case, this is an array with a single element of type=20
							LogicalCallContext.</P>
					</TD>
				</TR>
			</TABLE>
		</H4>
		<H4>method-call-flags &amp; PrimitiveArguments</H4>
		<P>Used for calls to methods in which all parameters are primitive =
types.</P>
		<P>
			<TABLE id=3D"Table5" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"119"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"119">uint</TD>
					<TD>Number of parameters</TD>
				</TR>
				<TR>
					<TD width=3D"119"><EM><A =
href=3D"#primitive-value">primitive-value</A> *</EM></TD>
					<TD>One value for each parameter</TD>
				</TR>
				<TR>
					<TD width=3D"119">object[]</TD>
					<TD>Only if logical context is included. In this case, this is an =
array with a=20
						single element of type LogicalCallContext</TD>
				</TR>
			</TABLE>
		</P>
		<H4>method-call-flags &amp; ObjectArguments</H4>
		<P>Used for calls to methods in which at least one parameter is not a =
primitive=20
			type.</P>
		<P>
			<TABLE id=3D"Table6" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"119"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"119">object[]</TD>
					<TD>
						<P>Array of parameters.
						</P>
						<P>If LogicalCallContext is included, it is an array of two =
elements. The first one=20
							is the array of parameters. The second one is the =
LogicalCallContext instance.</P>
					</TD>
				</TR>
			</TABLE>
			<H4>method-call-flags =3D OverlodadedMethodCall</H4>
		<P>Always used for calls to overloaded methods.</P>
		<P>
			<TABLE id=3D"Table7" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"119"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"119">object[]</TD>
					<TD>
						<P>Array with two elements. The first element is an array of =
parameters, and the=20
							second is an array of Type, wich has the types of the =
parameters</P>
						<P>If LogicalCallContext is included, a third element is the =
LogicalCallContext=20
							instance.</P>
					</TD>
				</TR>
			</TABLE>
			<a name=3D"elem22"></a>
			<H3>22 Method Response</H3>
		<P>Represents a method response. The format of a method response can =
vary depending=20
			on the type of the return value and parameters.&nbsp;The =
following&nbsp;table=20
			shows the common format:</P>
		<P>
			<TABLE id=3D"Table9" style=3D"WIDTH: 568px; HEIGHT: 140px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"142"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"142" height=3D"25">(byte) 22</TD>
					<TD height=3D"25">Element code</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM>method-response-flags</EM></TD>
					<TD>Describes which information includes the method call</TD>
				</TR>
				<TR>
					<TD width=3D"142"><EM>return-type-tag</EM></TD>
					<TD>Describes which kind of value is returned</TD>
				</TR>
				<TR>
					<TD width=3D"142">(bytes) 0, 0</TD>
					<TD>???</TD>
				</TR>
			</TABLE>
		<P></P>
		<P>The following tables describe the format of the message content =
depending on the=20
			value of method-response-flags:</P>
		<H4>method-response-flags &amp; NoArguments</H4>
		<P>Used when the method has no out arguments.</P>
		<P>
			<TABLE id=3D"Table10" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"139"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"139"><EM><EM><EM><A =
href=3D"#type-spec">type-spec</A><BR>
									<EM><A =
href=3D"#primitive-value">primitive-value</A></EM></EM></EM></EM></TD>
					<TD>
						<P><EM>Only if return-type-tag was PrimitiveType.<BR>
							</EM>Return value.</P>
					</TD>
				</TR>
				<TR>
					<TD width=3D"139">Header[]</TD>
					<TD>Only if there are Headers.</TD>
				</TR>
				<TR>
					<TD width=3D"139">object[]</TD>
					<TD>
						<P>Array with the following values:</P>
						<UL>
							<LI>
								Return value, only&nbsp;if <EM>return-type-tag</EM> was =
<EM>ObjectType</EM>
							<LI>
								LogicalCallContext instance, only&nbsp;if method-response-flags =
has the flag=20
								IncludeLogicalCallContext</LI></UL>
						<P>If the array is empty, it is not serialized.</P>
					</TD>
				</TR>
			</TABLE>
		</P>
		<H4>method-response-flags &amp; PrimitiveArguments</H4>
		<P>Used when all out arguments are primitive types.</P>
		<H2>
			<TABLE id=3D"Table12" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"139"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"139"><EM><EM><EM><A =
href=3D"#type-spec">type-spec</A><BR>
									<EM><A =
href=3D"#primitive-value">primitive-value</A></EM></EM></EM></EM></TD>
					<TD>
						<P><EM>Only if return-type-tag was PrimitiveType.<BR>
							</EM>Return value.</P>
					</TD>
				</TR>
				<TR>
					<TD width=3D"139">uint</TD>
					<TD>Number of out arguments</TD>
				</TR>
				<TR>
					<TD width=3D"139"><EM><EM><EM>( <A =
href=3D"#type-spec">type-spec</A>
									<BR>
									<EM><A href=3D"#primitive-value">primitive-value</A> =
)</EM></EM></EM>&nbsp;*</EM></TD>
					<TD>One value for each argument</TD>
				</TR>
				<TR>
					<TD width=3D"139">Header[]</TD>
					<TD>Only if there are Headers. Empty otherwise.</TD>
				</TR>
				<TR>
					<TD width=3D"139">object[]</TD>
					<TD>
						<P>Array with the following values:</P>
						<UL>
							<LI>
								Return value, only&nbsp;if <EM>return-type-tag</EM> was =
<EM>ObjectType</EM>
							<LI>
								LogicalCallContext instance, only&nbsp;if method-response-flags =
has the flag=20
								IncludeLogicalCallContext</LI></UL>
						<P>If the array is empty, it is not serialized.</P>
					</TD>
				</TR>
			</TABLE>
		</H2>
		<H4>method-response-flags &amp; ObjectArguments</H4>
		<P>Used when at least one out argument is not a primitive type, and=20
			LogicalCallContext is not included.</P>
		<H2>
			<TABLE id=3D"Table13" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"140"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"140"><EM><EM><EM><A =
href=3D"#type-spec">type-spec</A><BR>
									<EM><A =
href=3D"#primitive-value">primitive-value</A></EM></EM></EM></EM></TD>
					<TD>
						<P><EM>Only if return-type-tag was PrimitiveType.<BR>
							</EM>Return value.</P>
					</TD>
				</TR>
				<TR>
					<TD width=3D"140">Header[]</TD>
					<TD>Only if there are Headers.</TD>
				</TR>
				<TR>
					<TD width=3D"140">object[]</TD>
					<TD>Array that contains the out arguments</TD>
				</TR>
			</TABLE>
		</H2>
		<H4>method-response-flags &amp; ObjectResultAndArguments</H4>
		<P>Used in all other cases.</P>
		<H2>
			<TABLE id=3D"Table14" style=3D"WIDTH: 568px; HEIGHT: 75px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"568" border=3D"1">
				<TR>
					<TD width=3D"141"><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD width=3D"141"><EM><EM><EM><A =
href=3D"#type-spec">type-spec</A><BR>
									<EM><A =
href=3D"#primitive-value">primitive-value</A></EM></EM></EM></EM></TD>
					<TD>
						<P>Only if <EM>return-type-tag </EM>was <EM>PrimitiveType.<BR>
							</EM>Return value.</P>
					</TD>
				</TR>
				<TR>
					<TD width=3D"141">Header[]</TD>
					<TD>Only if there are Headers</TD>
				</TR>
				<TR>
					<TD width=3D"141">object[]</TD>
					<TD>
						<P>Array with the following values:</P>
						<UL>
							<LI>
							Array of out arguments, only if there are out arguments.
							<LI>
								Return value, only&nbsp;if <EM>return-type-tag</EM> was =
<EM>ObjectType</EM>
							<LI>
								LogicalCallContext instance, only&nbsp;if method-response-flags =
has the flag=20
								IncludeLogicalCallContext</LI></UL>
					</TD>
				</TR>
			</TABLE>
		</H2>
		<a name=3D"other"></a>
		<H2>Other elements</H2>
		<a name=3D"string"></a>
		<H3>string</H3>
		<P>A string value, serialized using BinaryWriter. It serializes the =
length of the=20
			string,&nbsp;using a&nbsp;7-bit encoded int, and then the string =
chars.</P>
		<a name=3D"primitive-value"></a>
		<H3>primitive-value</H3>
		<P>A primitive value. It can be serialized using BinaryWriter and =
deserialized=20
			using BinaryReader. DateTime is serialized as a long (using the Ticks =

			property).
		</P>
		<a name=3D"value"></a>
		<H3>value</H3>
		<P>It can be a <A href=3D"#primitive-value">primitive-value</A> or any =
of the=20
			following binary elements:</P>
		<UL>
			<LI>
				<A href=3D"#elem1">1 - RefTypeObject</A>
			(only for value types)
			<LI>
				<A href=3D"#elem4">4 - RuntimeObject</A>
			(only for value types)
			<LI>
				<A href=3D"#elem5">5 - ExternalObject</A>&nbsp;(only for value =
types)
			<LI>
				<A href=3D"#elem6">6 - String</A>
			<LI>
				<A href=3D"#elem8">8 - BoxedPrimitiveTypeValue</A>
			<LI>
				<A href=3D"#elem9">9 - ObjectReference</A>
			<LI>
				<A href=3D"#elem10">10 - NullValue</A>
			<LI>
				<A href=3D"#elem13">13 - ArrayFiller8b</A>&nbsp;(only inside=20
			single-dimensional object arrays)
			<LI>
				<A href=3D"#elem14">14 - ArrayFiller32b</A> (only inside =
single-dimensional=20
				object arrays)</LI></UL>
		<a name=3D"type-tag"></a>
		<H3>type-tag</H3>
		<P>Together with a <A href=3D"#type-spec">type-spec</A> value, =
identifies a type.=20
			Some types can be represented using several type-tags. In this case, =
the most=20
			specific type-tag is allways used (it will&nbsp;take less bytes).</P>
		<P>type-tag can be one of the following:</P>
		<P>
			<TABLE id=3D"Table18" cellSpacing=3D"1" cellPadding=3D"1" =
width=3D"600" border=3D"1">
				<TR>
					<TD><STRONG>Value</STRONG></TD>
					<TD><STRONG>Label</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
					<TD><STRONG>type-spec needed</STRONG></TD>
				</TR>
				<TR>
					<TD>0</TD>
					<TD>PrimitiveType</TD>
					<TD>A primitive type</TD>
					<TD>The code of the primitive type</TD>
				</TR>
				<TR>
					<TD>1</TD>
					<TD>String</TD>
					<TD>String class. type-spec is not needed.</TD>
					<TD>Not needed</TD>
				</TR>
				<TR>
					<TD>2</TD>
					<TD>ObjectType</TD>
					<TD>Object class. type-spec is not needed.</TD>
					<TD>Not needed</TD>
				</TR>
				<TR>
					<TD height=3D"20">3</TD>
					<TD height=3D"20">RuntimeType</TD>
					<TD height=3D"20">A type from the .NET runtime (including arrays of =
.NET types)</TD>
					<TD height=3D"20">The name of the class</TD>
				</TR>
				<TR>
					<TD>4</TD>
					<TD>GenericType</TD>
					<TD>Any other&nbsp;type (including arrays)</TD>
					<TD>The name of the class and the id of the assembly</TD>
				</TR>
				<TR>
					<TD>5</TD>
					<TD>ArrayOfObject</TD>
					<TD>Array of class Object</TD>
					<TD>Not needed</TD>
				</TR>
				<TR>
					<TD>6</TD>
					<TD>ArrayOfString</TD>
					<TD>Array of class String</TD>
					<TD>Not needed</TD>
				</TR>
				<TR>
					<TD>7</TD>
					<TD>ArrayOfPrimitiveType</TD>
					<TD>Array of primitive type</TD>
					<TD>The code of the primitive type</TD>
				</TR>
			</TABLE>
		</P>
		<a name=3D"type-spec"></a>
		<H3>type-spec</H3>
		<P>It is the name or the code of a type. To decode it, a <A =
href=3D"#type-tag">type-tag</A>
			value is needed. The following table shows the format of type-spec =
for each=20
			type-tag value:</P>
		<H4>type-tag =3D PrimitiveType or ArrayOfPrimitiveType</H4>
		<P>
			<TABLE id=3D"Table16" style=3D"WIDTH: 560px; HEIGHT: 14px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"560" border=3D"1">
				<TR>
					<TD><STRONG>Element</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD>byte</TD>
					<TD>The code of the primitive type. It is the value of the enum =
TypeCode - 1.</TD>
				</TR>
			</TABLE>
		</P>
		<H4>type-tag =3D RuntimeType</H4>
		<P>
			<TABLE id=3D"Table15" style=3D"WIDTH: 560px; HEIGHT: 14px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"560" border=3D"1">
				<TR>
					<TD><STRONG><STRONG>Element</STRONG></STRONG></TD>
					<TD><STRONG><STRONG>Description</STRONG></STRONG></TD>
				</TR>
				<TR>
					<TD><EM><A href=3D"#string">string</A></EM></TD>
					<TD>The name of the class, including the namespace</TD>
				</TR>
			</TABLE>
			<H4>type-tag =3D GenericType</H4>
		<P>
			<TABLE id=3D"Table17" style=3D"WIDTH: 560px; HEIGHT: 14px" =
cellSpacing=3D"1" cellPadding=3D"1" width=3D"560" border=3D"1">
				<TR>
					<TD><STRONG>Element</STRONG></TD>
					<TD><STRONG><STRONG>Description</STRONG></STRONG></TD>
				</TR>
				<TR>
					<TD><EM><A href=3D"#string">string</A></EM></TD>
					<TD>The name of the class, including the namespace</TD>
				</TR>
				<TR>
					<TD>uint</TD>
					<TD>Id of the assembly where the class is defined</TD>
				</TR>
			</TABLE>
			<H3>
				<H4>Other type-tag</H4>
			</H3>
		<P>For other type-tag values, no type-spec is needed.</P>
		<a name=3D"method-call-flags"></a>
		<H3>method-call-flags</H3>
		<P>
			<TABLE id=3D"Table3" cellSpacing=3D"1" cellPadding=3D"1" =
width=3D"600" border=3D"1">
				<TR>
					<TD><STRONG>Value</STRONG></TD>
					<TD><STRONG>Label</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD>1</TD>
					<TD>NoArguments</TD>
					<TD>No arguments included</TD>
				</TR>
				<TR>
					<TD>2</TD>
					<TD>PrimitiveArguments</TD>
					<TD>Primitive type arguments</TD>
				</TR>
				<TR>
					<TD>4</TD>
					<TD>ObjectArguments</TD>
					<TD>At least one out argument is not from a primitive type</TD>
				</TR>
				<TR>
					<TD height=3D"20">8</TD>
					<TD height=3D"20"></TD>
					<TD height=3D"20"><EM>Not used</EM></TD>
				</TR>
				<TR>
					<TD>16</TD>
					<TD>ExcludeLogicalCallContext</TD>
					<TD>LogicalContext not included</TD>
				</TR>
				<TR>
					<TD>32</TD>
					<TD></TD>
					<TD>???</TD>
				</TR>
				<TR>
					<TD>63</TD>
					<TD>OverlodadedMethodCall</TD>
					<TD>Call of overloaded method</TD>
				</TR>
				<TR>
					<TD>64</TD>
					<TD>IncludeLogicalCallContext</TD>
					<TD>LogicalContext included</TD>
				</TR>
			</TABLE>
		</P>
		<a name=3D"method-response-flags"></a>
		<H3>method-response-flags</H3>
		<P>
			<TABLE id=3D"Table4" cellSpacing=3D"1" cellPadding=3D"1" =
width=3D"600" border=3D"1">
				<TR>
					<TD><STRONG>Value</STRONG></TD>
					<TD width=3D"190"><STRONG>Label</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD>1</TD>
					<TD width=3D"190">NoArguments</TD>
					<TD>Response with no out arguments</TD>
				</TR>
				<TR>
					<TD>2</TD>
					<TD width=3D"190">PrimitiveArguments</TD>
					<TD>
						Response with primitive type out arguments</TD>
				</TR>
				<TR>
					<TD>4</TD>
					<TD width=3D"190">ObjectArguments</TD>
					<TD>Response with primitive type return value, and with at least =
one out argument=20
						that is not a primitive type.</TD>
				</TR>
				<TR>
					<TD>8</TD>
					<TD width=3D"190">ObjectResultAndArguments</TD>
					<TD>Response with return value that is not primitive, and with at =
least one out=20
						argument that is not a primitive type.</TD>
				</TR>
				<TR>
					<TD>16</TD>
					<TD width=3D"190">ExcludeLogicalCallContext</TD>
					<TD>LogicalContext not included</TD>
				</TR>
				<TR>
					<TD>32</TD>
					<TD width=3D"190"></TD>
					<TD>???</TD>
				</TR>
				<TR>
					<TD>64</TD>
					<TD width=3D"190">IncludeLogicalCallContext</TD>
					<TD>LogicalContext included</TD>
				</TR>
			</TABLE>
		</P>
		<a name=3D"return-type-tag"></a>
		<H3>return-type-tag</H3>
		<P>
			<TABLE id=3D"Table11" cellSpacing=3D"1" cellPadding=3D"1" =
width=3D"600" border=3D"1">
				<TR>
					<TD><STRONG>Value</STRONG></TD>
					<TD><STRONG>Label</STRONG></TD>
					<TD><STRONG>Description</STRONG></TD>
				</TR>
				<TR>
					<TD>2</TD>
					<TD>Null</TD>
					<TD>Null return value</TD>
				</TR>
				<TR>
					<TD>8</TD>
					<TD>PrimitiveType</TD>
					<TD>Primitive type return value</TD>
				</TR>
				<TR>
					<TD>16</TD>
					<TD>ObjectType</TD>
					<TD>Object instance return value</TD>
				</TR>
				<TR>
					<TD>32</TD>
					<TD>Exception</TD>
					<TD>Method response is an exception</TD>
				</TR>
			</TABLE>
		</P>
		<HR width=3D"100%" SIZE=3D"1">
		<FONT size=3D"1">2003 (C) Lluis Sanchez Gual&nbsp; (</FONT> <A =
href=3D"mailto:lluis@ideary.com">
			<FONT size=3D"1">lluis@ideary.com</FONT></A><FONT size=3D"1">)</FONT>
		<P>&nbsp;</P>
	</body>
</html>

------=_NextPart_000_0103_01C2BE3D.3B2AAC10--