Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > 864d1c3c3cd8df4e3a2692faf8776e05 > files > 257

db4o-doc-7.4-2.fc13.i686.rpm

<html>
  <head>
    <META http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Using Messaging API For Remote Code Execution</title>
    <link rel="stylesheet" type="text/css" href="../../../style.css">
  </head>
  <body>
    <div class="CommonContent">
      <div class="CommonContentArea">
        <h1>Using Messaging API For Remote Code Execution</h1><script>
//We attach this function to a browser object as a variable so that if multiple of these blocks are
//present on the same page, then they will simply over-write eachother with the same function instead
//of generating a naming collision.
window.WikiCodeFormattingCopyToClipboard = function copyToClipboard(sID){
	var sContent = document.getElementById(sID).innerText;
	if( window.clipboardData && clipboardData.setData )
	{
		clipboardData.setData("Text", sContent);
	}
	else
	{
		alert("You must enable javascript access to your clipboard for this feature to work. Please referr to your browser documentation or Google search for instructions.");
	}
}
</script>

<p>Messaging API gives you an easy and powerful tool for remote code execution. The short overview of the API is in <a href="../messaging.html" class="wikiLink">Messaging chapter</a>. </p>
<p>All you will need to do is to define specific message class or classes (should be shared between client and server).</p>
<p>The client side can issue messages using:</p>



<span name="cs_wiki_filter" csw_filters="cs">
<p>c#:   <code>IMessageSender#Send(message) </code></p>
</span>

<span name="cs_wiki_filter" csw_filters="vb">
<p>VB:   <code>IMessageSender#Send(message) </code></p>
</span>

<p>The server side should register a message listener:</p>



<span name="cs_wiki_filter" csw_filters="cs">
<p>c#: <code>Configuration#SetMessageRecipient(IMessageRecipient)</code></p>
</span>

<span name="cs_wiki_filter" csw_filters="vb">
<p>VB: <code>Configuration#SetMessageRecipient(IMessageRecipient)</code></p>
</span>
Message recipient should define a response to the different messages received in


<span name="cs_wiki_filter" csw_filters="cs">
<p>c#:   <code>ProcessMessage(IObjectContainer objectContainer, object message) </code></p>
</span>

<span name="cs_wiki_filter" csw_filters="vb">
<p><code>vb:   ProcessMessage(ByVal objectContainer As IObjectContainer, ByVal message As Object) </code></p>
</span>
<p>method. ObjectContainer parameter gives full control over the database.</p>
<p>Let's reset our database and try updating using special UpdateServer message.</p>


<span name="cs_wiki_filter" csw_filters="cs">
<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">RemoteExample.cs: <span class="fscMemberName">SetObjects</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> SetObjects()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_35_333_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_35_333_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_35_333_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_35_333_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_35_333_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_35_333_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_35_333_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_35_333_Open_Text').style.display='inline';"/>    </span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_35_333_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_35_333_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      File.Delete(Db4oFileName);
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      IObjectContainer db </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(Db4oFileName);
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">try</span><span style="color: #000000;"> 
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_139_274_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_139_274_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_139_274_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_139_274_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_139_274_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_139_274_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_139_274_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_139_274_Open_Text').style.display='inline';"/>      </span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_139_274_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_139_274_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        </span><span style="color: #0000FF;">for</span><span style="color: #000000;"> (</span><span style="color: #0000FF;">int</span><span style="color: #000000;"> i </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;">; i </span><span style="color: #000000;">&lt;</span><span style="color: #000000;"> </span><span style="color: #800080;">5</span><span style="color: #000000;">; i</span><span style="color: #000000;">++</span><span style="color: #000000;">) 
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_178_236_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_178_236_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_178_236_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_178_236_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_178_236_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_178_236_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_178_236_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_178_236_Open_Text').style.display='inline';"/>        </span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_178_236_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_178_236_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>          Car car </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">car</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">+</span><span style="color: #000000;">i);
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>          db.Set(car);
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>        }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        db.Set(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> RemoteExample());
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>      }</span></span><span style="color: #000000;"> 
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">finally</span><span style="color: #000000;"> 
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_291_313_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_291_313_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_291_313_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_291_313_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_291_313_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_291_313_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_291_313_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_291_313_Open_Text').style.display='inline';"/>      </span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_291_313_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_SetObjects_1533_54_291_313_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        db.Close();
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>      }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      CheckCars();
</span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>    }</span></span></div></pre></div></div><div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">RemoteExample.cs: <span class="fscMemberName">UpdateCarsWithMessage</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> UpdateCarsWithMessage() 
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_47_915_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_47_915_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_47_915_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_47_915_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_47_915_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_47_915_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_47_915_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_47_915_Open_Text').style.display='inline';"/>    </span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_47_915_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_47_915_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            IConfiguration configuration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration();
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #008000;">//</span><span style="color: #008000;"> create message handler on the server</span><span style="color: #008000;">
</span><span style="color: #008080;">05</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">            configuration.ClientServer().SetMessageRecipient(
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> UpdateMessageRecipient());
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      IObjectServer server</span><span style="color: #000000;">=</span><span style="color: #000000;">Db4oFactory.OpenServer(configuration, Db4oFileName,</span><span style="color: #800080;">0xdb40</span><span style="color: #000000;">);
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            server.GrantAccess(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">user</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">password</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">);
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">try</span><span style="color: #000000;"> 
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_420_853_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_420_853_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_420_853_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_420_853_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_420_853_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_420_853_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_420_853_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_420_853_Open_Text').style.display='inline';"/>      </span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_420_853_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_420_853_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        </span><span style="color: #008000;">//</span><span style="color: #008000;"> send message object to the server</span><span style="color: #008000;">
</span><span style="color: #008080;">12</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">                IConfiguration clientConfiguration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration();
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                IMessageSender sender </span><span style="color: #000000;">=</span><span style="color: #000000;"> clientConfiguration.ClientServer().GetMessageSender();
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                IObjectContainer client </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenClient(clientConfiguration, 
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">localhost</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, </span><span style="color: #800080;">0xdb40</span><span style="color: #000000;">, </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">user</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">password</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">);
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        sender.Send(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> UpdateServer());
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        client.Close();
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>      }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">finally</span><span style="color: #000000;"> 
</span><span style="color: #008080;">20</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_869_895_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_869_895_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_869_895_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_869_895_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_869_895_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_869_895_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_869_895_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_869_895_Open_Text').style.display='inline';"/>      </span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_869_895_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteCS.ZipsRemoteExample.Cs_RemoteExample.Cs_UpdateCarsWithMessage_1587_61_869_895_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        server.Close();
</span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>      }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      CheckCars();
</span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>    }</span></span></div></pre></div></div> <br></p>
</span>

<span name="cs_wiki_filter" csw_filters="vb">
<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">RemoteExample.vb: <span class="fscMemberName">SetObjects</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_SetObjects_1717_54"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_SetObjects_1717_54_15_511_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_SetObjects_1717_54_15_511_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_SetObjects_1717_54_15_511_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_SetObjects_1717_54_15_511_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_SetObjects_1717_54_15_511_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_SetObjects_1717_54_15_511_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_SetObjects_1717_54_15_511_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_SetObjects_1717_54_15_511_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_SetObjects_1717_54_15_511_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub SetObjects()</span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_SetObjects_1717_54_15_511_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> SetObjects()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            File.Delete(Db4oFileName)
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> db </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(Db4oFileName)
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> i </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Integer</span><span style="color: #000000;">
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">For</span><span style="color: #000000;"> i </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;"> </span><span style="color: #0000FF;">To</span><span style="color: #000000;"> </span><span style="color: #800080;">5</span><span style="color: #000000;"> </span><span style="color: #000000;">-</span><span style="color: #000000;"> </span><span style="color: #800080;">1</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Step</span><span style="color: #000000;"> i </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800080;">1</span><span style="color: #000000;">
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> car </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Car </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">car</span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> i.ToString())
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    db.Set(car)
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Next</span><span style="color: #000000;">
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                db.Set(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> RemoteExample())
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Finally</span><span style="color: #000000;">
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                db.Close()
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            CheckCars()
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div><div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">RemoteExample.vb: <span class="fscMemberName">UpdateCarsWithMessage</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_UpdateCarsWithMessage_1771_61"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_UpdateCarsWithMessage_1771_61_15_1000_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_UpdateCarsWithMessage_1771_61_15_1000_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_UpdateCarsWithMessage_1771_61_15_1000_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_UpdateCarsWithMessage_1771_61_15_1000_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_UpdateCarsWithMessage_1771_61_15_1000_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_UpdateCarsWithMessage_1771_61_15_1000_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_UpdateCarsWithMessage_1771_61_15_1000_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_UpdateCarsWithMessage_1771_61_15_1000_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_UpdateCarsWithMessage_1771_61_15_1000_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub UpdateCarsWithMessage()</span><span id="ResourcesReferenceClient-ServerRemote_Code_ExecutionremoteVB.ZipsRemoteExample.Vb_RemoteExample.Vb_UpdateCarsWithMessage_1771_61_15_1000_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> UpdateCarsWithMessage()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #008000;">'</span><span style="color: #008000;"> create message handler on the server</span><span style="color: #008000;">
</span><span style="color: #008080;">03</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> configuration </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IConfiguration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration()
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            configuration.ClientServer.SetMessageRecipient(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> UpdateMessageRecipient())
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> server </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectServer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenServer(configuration, Db4oFileName, </span><span style="color: #000000;">&amp;</span><span style="color: #000000;">HDB40)
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            server.GrantAccess(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">user</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">password</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">)
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> clientConfiguration </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IConfiguration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration()
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> sender </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IMessageSender </span><span style="color: #000000;">=</span><span style="color: #000000;"> clientConfiguration.ClientServer().GetMessageSender()
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> client </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenClient(clientConfiguration, </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">localhost</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, </span><span style="color: #000000;">&amp;</span><span style="color: #000000;">HDB40, </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">user</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">password</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">)
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #008000;">'</span><span style="color: #008000;"> send message object to the server</span><span style="color: #008000;">
</span><span style="color: #008080;">12</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">                sender.Send(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> UpdateServer())
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                client.Close()
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Finally</span><span style="color: #000000;">
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                server.Close()
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            CheckCars()
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div> <br></p>
</span>You can also put some information in the message being sent (UpdateServer class).
<p>The advantage of this method is that having predefined message types you can make any changes to the handling code only on the server side. In the situations with many distributed clients it can really save you lots of time on support.</p></div>
    </div>
    <div id="footer">
					This revision (10) was last Modified 2007-05-09T07:45:01 by Tetyana.
				</div>
  </body>
</html>