<html> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Messaging</title> <link rel="stylesheet" type="text/css" href="../../style.css"> </head> <body> <div class="CommonContent"> <div class="CommonContentArea"> <h1>Messaging</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>In client/server mode the TCP connection between the client and the server can also be used to send messages from the client to the server.</p> <p>Possible usecases could be:</p> <ul> <li>shutting down and restarting the server</li> <li>triggering server backup</li> <li>using a customized login strategy to restrict the number of allowed client connections</li> </ul> <p>Here is some example code how this can be done.</p> <p>First we need to decide on a class that we want to use as the message. Any object that is storable in db4o can be used as a message, but strings and other simple types will not be carried (as they are not storable in db4o on their own). Let's create a dedicated class:</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">MyClientServerMessage.cs</span></div><div class="fscCode"><pre ID="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_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;">using</span><span style="color: #000000;"> System; </span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/> </span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">namespace</span><span style="color: #000000;"> Db4objects.Db4odoc.Messaging </span><span style="color: #008080;">04</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_54_286_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_54_286_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_54_286_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_54_286_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_54_286_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_54_286_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_54_286_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_54_286_Open_Text').style.display='inline';"/></span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_54_286_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_54_286_Open_Text"><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;">class</span><span style="color: #000000;"> MyClientServerMessage </span><span style="color: #008080;">06</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_87_284_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_87_284_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_87_284_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_87_284_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_87_284_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_87_284_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_87_284_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_87_284_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_87_284_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_87_284_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;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> _info; </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: #008080;">09</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> MyClientServerMessage(String info) </span><span style="color: #008080;">10</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_160_187_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_160_187_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_160_187_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_160_187_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_160_187_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_160_187_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_160_187_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_160_187_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_160_187_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_160_187_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: #0000FF;">this</span><span style="color: #000000;">._info </span><span style="color: #000000;">=</span><span style="color: #000000;"> info; </span><span style="color: #008080;">12</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;">13</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </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;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">override</span><span style="color: #000000;"> String ToString() </span><span style="color: #008080;">15</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_231_281_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_231_281_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_231_281_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_231_281_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_231_281_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_231_281_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_231_281_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_231_281_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_231_281_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMyClientServerMessage.Cs_MyClientServerMessage.Cs_765_54_231_281_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"/> </span><span style="color: #0000FF;">return</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">MyClientServerMessage: </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> _info; </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/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/ExpandedBlockEnd.gif" align="top"/>}</span></span></div></pre></div></div> </span> <span name="cs_wiki_filter" csw_filters="vb"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">MyClientServerMessage.vb</span></div><div class="fscCode"><pre ID="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_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: #008000;">'</span><span style="color: #008000;"> Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com </span><span style="color: #008000;"> </span><span style="color: #008080;">02</span><span style="color: #008000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #008080;">03</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_66_416_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_66_416_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_66_416_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_66_416_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_66_416_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_66_416_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_66_416_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_66_416_Open_Text').style.display='inline';"/></span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_66_416_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Namespace Db4objects</span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_66_416_Open_Text"><span style="color: #0000FF;">Namespace</span><span style="color: #000000;"> Db4objects.Db4odoc.Messaging </span><span style="color: #008080;">04</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_109_402_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_109_402_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_109_402_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_109_402_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_109_402_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_109_402_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_109_402_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_109_402_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_109_402_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Class MyClientServerMessage</span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_109_402_Open_Text"><span style="color: #0000FF;">Class</span><span style="color: #000000;"> MyClientServerMessage </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;">Private</span><span style="color: #000000;"> _info </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">String</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: #008080;">07</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_185_258_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_185_258_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_185_258_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_185_258_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_185_258_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_185_258_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_185_258_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_185_258_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_185_258_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub New()</span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_185_258_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;">(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> info </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">String</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;">Me</span><span style="color: #000000;">._info </span><span style="color: #000000;">=</span><span style="color: #000000;"> info </span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Sub</span></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"/> </span><span style="color: #008080;">11</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_285_388_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_285_388_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_285_388_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_285_388_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_285_388_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_285_388_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_285_388_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_285_388_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Overrides</span><span style="color: #000000;"> </span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_285_388_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Function ToString()</span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMyClientServerMessage.Vb_MyClientServerMessage.Vb_877_54_285_388_Open_Text"><span style="color: #0000FF;">Function</span><span style="color: #000000;"> ToString() </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">String</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"/> </span><span style="color: #0000FF;">Return</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">MyClientServerMessage: </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> _info </span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Function</span></span><span style="color: #000000;"> </span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Class</span></span><span style="color: #000000;"> </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 Namespace</span></span></div></pre></div></div> </span> <p>Now we have to add some code to the server to react to arriving messages. This can be done by configuring a MessageRecipient object on the server. Let's simply print out all objects that arrive as messages. For the following we assume that we already have an ObjectServer object, opened with <a href="embedded.html" class="wikiLink">Db4o.openServer()</a>.</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">MessagingExample.cs</span></div><div class="fscCode"><pre ID="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49"><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;">using</span><span style="color: #000000;"> System; </span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">using</span><span style="color: #000000;"> Db4objects.Db4o; </span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">using</span><span style="color: #000000;"> Db4objects.Db4o.Config; </span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">using</span><span style="color: #000000;"> Db4objects.Db4o.Messaging; </span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/> </span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">namespace</span><span style="color: #000000;"> Db4objects.Db4odoc.Messaging </span><span style="color: #008080;">07</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_140_1449_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_140_1449_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_140_1449_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_140_1449_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_140_1449_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_140_1449_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_140_1449_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_140_1449_Open_Text').style.display='inline';"/></span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_140_1449_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_140_1449_Open_Text"><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: #008080;">09</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">class</span><span style="color: #000000;"> MessagingExample </span><span style="color: #008080;">10</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_176_1215_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_176_1215_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_176_1215_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_176_1215_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_176_1215_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_176_1215_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_176_1215_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_176_1215_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_176_1215_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_176_1215_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: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">const</span><span style="color: #000000;"> </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> Db4oFileName </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">reference.db4o</span><span style="color: #800000;">"</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"/> </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;">public</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;"> Main(</span><span style="color: #0000FF;">string</span><span style="color: #000000;">[] Args) </span><span style="color: #008080;">14</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_290_332_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_290_332_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_290_332_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_290_332_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_290_332_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_290_332_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_290_332_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_290_332_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_290_332_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_290_332_Open_Text"><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"/> ConfigureServer(); </span><span style="color: #008080;">16</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;">17</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;">end Main</span><span style="color: #008000;"> </span><span style="color: #008080;">18</span><span style="color: #008000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></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;">public</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;"> ConfigureServer() </span><span style="color: #008080;">20</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_395_1186_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_395_1186_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_395_1186_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_395_1186_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_395_1186_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_395_1186_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_395_1186_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_395_1186_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_395_1186_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_395_1186_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"/> IConfiguration configuration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration(); </span><span style="color: #008080;">22</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;"> SimpleMessageRecipient()); </span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectServer objectServer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenServer(configuration, Db4oFileName, </span><span style="color: #800080;">0</span><span style="color: #000000;">); </span><span style="color: #008080;">24</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;">25</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_672_1133_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_672_1133_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_672_1133_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_672_1133_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_672_1133_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_672_1133_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_672_1133_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_672_1133_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_672_1133_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_672_1133_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IConfiguration clientConfiguration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration(); </span><span style="color: #008080;">27</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;"> Here is what we would do on the client to send the message</span><span style="color: #008000;"> </span><span style="color: #008080;">28</span><span style="color: #008000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> IMessageSender sender </span><span style="color: #000000;">=</span><span style="color: #000000;"> clientConfiguration.ClientServer().GetMessageSender(); </span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectContainer clientObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> objectServer.OpenClient(clientConfiguration); </span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">31</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;"> MyClientServerMessage(</span><span style="color: #800000;">"</span><span style="color: #800000;">Hello from client.</span><span style="color: #800000;">"</span><span style="color: #000000;">)); </span><span style="color: #008080;">32</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> clientObjectContainer.Close(); </span><span style="color: #008080;">33</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;">34</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;">35</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1150_1182_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1150_1182_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1150_1182_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1150_1182_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1150_1182_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1150_1182_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1150_1182_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1150_1182_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1150_1182_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1150_1182_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">36</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> objectServer.Close(); </span><span style="color: #008080;">37</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;">38</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;">39</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;"> end ConfigureServer </span><span style="color: #008000;"> </span><span style="color: #008080;">40</span><span style="color: #008000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/></span><span style="color: #000000;"> }</span></span><span style="color: #000000;"> </span><span style="color: #008080;">41</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">42</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">class</span><span style="color: #000000;"> SimpleMessageRecipient: IMessageRecipient </span><span style="color: #008080;">43</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1274_1447_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1274_1447_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1274_1447_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1274_1447_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1274_1447_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1274_1447_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1274_1447_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1274_1447_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1274_1447_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1274_1447_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">44</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> ProcessMessage(IMessageContext context,Object message) </span><span style="color: #008080;">45</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1348_1444_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1348_1444_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1348_1444_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1348_1444_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1348_1444_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1348_1444_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1348_1444_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1348_1444_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1348_1444_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServermessagingCS.ZipsMessagingExample.Cs_MessagingExample.Cs_1326_49_1348_1444_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">46</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;"> message objects will arrive in this code block</span><span style="color: #008000;"> </span><span style="color: #008080;">47</span><span style="color: #008000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> System.Console.WriteLine(message); </span><span style="color: #008080;">48</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;">49</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;">50</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>}</span></span></div></pre></div></div> </span> <span name="cs_wiki_filter" csw_filters="vb"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">MessagingExample.vb</span></div><div class="fscCode"><pre ID="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49"><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: #008000;">'</span><span style="color: #008000;"> Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com </span><span style="color: #008000;"> </span><span style="color: #008080;">02</span><span style="color: #008000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">Imports</span><span style="color: #000000;"> System </span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">Imports</span><span style="color: #000000;"> Db4objects.Db4o </span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">Imports</span><span style="color: #000000;"> Db4objects.Db4o.Config </span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">Imports</span><span style="color: #000000;"> Db4objects.Db4o.Messaging </span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/> </span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/> </span><span style="color: #008080;">08</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_171_1647_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_171_1647_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_171_1647_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_171_1647_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_171_1647_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_171_1647_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_171_1647_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_171_1647_Open_Text').style.display='inline';"/></span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_171_1647_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Namespace Db4objects</span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_171_1647_Open_Text"><span style="color: #0000FF;">Namespace</span><span style="color: #000000;"> Db4objects.Db4odoc.Messaging </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: #008080;">10</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_222_1280_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_222_1280_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_222_1280_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_222_1280_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_222_1280_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_222_1280_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_222_1280_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_222_1280_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_222_1280_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Class MessagingExample</span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_222_1280_Open_Text"><span style="color: #0000FF;">Class</span><span style="color: #000000;"> MessagingExample </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;">Private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Const</span><span style="color: #000000;"> Db4oFileName </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">String</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">reference.db4o</span><span style="color: #800000;">"</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"/> </span><span style="color: #008080;">13</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_332_1236_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_332_1236_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_332_1236_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_332_1236_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_332_1236_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_332_1236_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_332_1236_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_332_1236_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_332_1236_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub ConfigureServer()</span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_332_1236_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> ConfigureServer() </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;">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;">15</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;"> SimpleMessageRecipient()) </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;">Dim</span><span style="color: #000000;"> objectServer </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: #800080;">0</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"/> </span><span style="color: #0000FF;">Try</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"/> </span><span style="color: #008000;">'</span><span style="color: #008000;"> Here is what we would do on the client to send the message</span><span style="color: #008000;"> </span><span style="color: #008080;">19</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;"> 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;">20</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;">21</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;"> clientObjectContainer </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> objectServer.OpenClient(clientConfiguration) </span><span style="color: #008080;">22</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;"> MyClientServerMessage(</span><span style="color: #800000;">"</span><span style="color: #800000;">Hello from client.</span><span style="color: #800000;">"</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"/> clientObjectContainer.Close() </span><span style="color: #008080;">24</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;">25</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> objectServer.Close() </span><span style="color: #008080;">26</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;">27</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Sub</span></span><span style="color: #000000;"> </span><span style="color: #008080;">28</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;"> end ConfigureServer</span><span style="color: #008000;"> </span><span style="color: #008080;">29</span><span style="color: #008000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #0000FF;">End Class</span></span><span style="color: #000000;"> </span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">31</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1293_1632_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1293_1632_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1293_1632_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1293_1632_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1293_1632_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1293_1632_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1293_1632_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1293_1632_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1293_1632_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Class SimpleMessageRecipient</span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1293_1632_Open_Text"><span style="color: #0000FF;">Class</span><span style="color: #000000;"> SimpleMessageRecipient </span><span style="color: #008080;">32</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Implements</span><span style="color: #000000;"> IMessageRecipient </span><span style="color: #008080;">33</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1374_1618_Open_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1374_1618_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1374_1618_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1374_1618_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1374_1618_Closed_Image" src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1374_1618_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1374_1618_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1374_1618_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1374_1618_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub ProcessMessage()</span><span id="ResourcesReferenceClient-ServermessagingVB.ZipsMessagingExample.Vb_MessagingExample.Vb_1433_49_1374_1618_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> ProcessMessage(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> context </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IMessageContext, </span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> message </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Object</span><span style="color: #000000;">) </span><span style="color: #0000FF;">Implements</span><span style="color: #000000;"> IMessageRecipient.ProcessMessage </span><span style="color: #008080;">34</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;"> message objects will arrive in this code block</span><span style="color: #008000;"> </span><span style="color: #008080;">35</span><span style="color: #008000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> System.Console.WriteLine(message) </span><span style="color: #008080;">36</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Sub</span></span><span style="color: #000000;"> </span><span style="color: #008080;">37</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Class</span></span><span style="color: #000000;"> </span><span style="color: #008080;">38</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">39</span><span style="color: #000000;"><img src="../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/></span><span style="color: #0000FF;">End Namespace</span></span></div></pre></div></div> </span> <p>The MessageSender object on the client can be reused to send multiple messages.</p></div> </div> <div id="footer"> This revision (8) was last Modified 2008-04-14T16:05:00 by Tetyana. </div> </body> </html>