<html> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Network Server</title> <link rel="stylesheet" type="text/css" href="../../../style.css"> </head> <body> <div class="CommonContent"> <div class="CommonContentArea"> <h1>Network Server</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 order to make the <a href="../embedded.html" class="wikiLink">embedded server</a> operate over a TCP/IP network, we just need to specify a port number greater than zero and set up one or more accounts for our client(s).</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">ClientServerExample.cs: <span class="fscMemberName">AccessRemoteServer</span></span></div><div class="fscCode"><pre ID="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80"><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;"> AccessRemoteServer() </span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_43_419_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_43_419_Open_Text').style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_43_419_Closed_Image').style.display='inline'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_43_419_Closed_Text').style.display='inline';"/><img id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_43_419_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_43_419_Closed_Text').style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_43_419_Open_Image').style.display='inline'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_43_419_Open_Text').style.display='inline';"/> </span><span id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_43_419_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_43_419_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"/> IObjectServer server </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenServer(Db4oFileName, ServerPort); </span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> server.GrantAccess(ServerUser, ServerPassword); </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="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_182_374_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_182_374_Open_Text').style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_182_374_Closed_Image').style.display='inline'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_182_374_Closed_Text').style.display='inline';"/><img id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_182_374_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_182_374_Closed_Text').style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_182_374_Open_Image').style.display='inline'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_182_374_Open_Text').style.display='inline';"/> </span><span id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_182_374_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_182_374_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"/> IObjectContainer client </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenClient(</span><span style="color: #800000;">"</span><span style="color: #800000;">localhost</span><span style="color: #800000;">"</span><span style="color: #000000;">, ServerPort, ServerUser, ServerPassword); </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: #008000;">//</span><span style="color: #008000;"> Do something with this client, or open more clients</span><span style="color: #008000;"> </span><span style="color: #008080;">09</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> client.Close(); </span><span style="color: #008080;">10</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;">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 id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_389_415_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_389_415_Open_Text').style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_389_415_Closed_Image').style.display='inline'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_389_415_Closed_Text').style.display='inline';"/><img id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_389_415_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_389_415_Closed_Text').style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_389_415_Open_Image').style.display='inline'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_389_415_Open_Text').style.display='inline';"/> </span><span id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_389_415_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_AccessRemoteServer_265_80_389_415_Open_Text"><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"/> server.Close(); </span><span style="color: #008080;">14</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;">15</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">ClientServerExample.vb: <span class="fscMemberName">AccessRemoteServer</span></span></div><div class="fscCode"><pre ID="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_AccessRemoteServer_409_80"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_AccessRemoteServer_409_80_14_517_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_AccessRemoteServer_409_80_14_517_Open_Text').style.display='none'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_AccessRemoteServer_409_80_14_517_Closed_Image').style.display='inline'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_AccessRemoteServer_409_80_14_517_Closed_Text').style.display='inline';"/><img id="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_AccessRemoteServer_409_80_14_517_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_AccessRemoteServer_409_80_14_517_Closed_Text').style.display='none'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_AccessRemoteServer_409_80_14_517_Open_Image').style.display='inline'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_AccessRemoteServer_409_80_14_517_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_AccessRemoteServer_409_80_14_517_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub AccessRemoteServer()</span><span id="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_AccessRemoteServer_409_80_14_517_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> AccessRemoteServer() </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: #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(Db4oFileName, ServerPort) </span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> server.GrantAccess(ServerUser, ServerPassword) </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;"> 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(</span><span style="color: #800000;">"</span><span style="color: #800000;">localhost</span><span style="color: #800000;">"</span><span style="color: #000000;">, ServerPort, ServerUser, ServerPassword) </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: #008000;">'</span><span style="color: #008000;"> Do something with this client, or open more clients</span><span style="color: #008000;"> </span><span style="color: #008080;">07</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> client.Close() </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;">Finally</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"/> server.Close() </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;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;"> </span><span style="color: #008080;">11</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> </span> <p>The client connects providing host, port, user name and password.</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">ClientServerExample.cs: <span class="fscMemberName">QueryRemoteServer</span></span></div><div class="fscCode"><pre ID="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_QueryRemoteServer_633_79"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">1</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;"> QueryRemoteServer(</span><span style="color: #0000FF;">int</span><span style="color: #000000;"> port, </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> user, </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> password) </span><span style="color: #008080;">2</span><span style="color: #000000;"><img id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_QueryRemoteServer_633_79_80_234_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_QueryRemoteServer_633_79_80_234_Open_Text').style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_QueryRemoteServer_633_79_80_234_Closed_Image').style.display='inline'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_QueryRemoteServer_633_79_80_234_Closed_Text').style.display='inline';"/><img id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_QueryRemoteServer_633_79_80_234_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_QueryRemoteServer_633_79_80_234_Closed_Text').style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_QueryRemoteServer_633_79_80_234_Open_Image').style.display='inline'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_QueryRemoteServer_633_79_80_234_Open_Text').style.display='inline';"/> </span><span id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_QueryRemoteServer_633_79_80_234_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_QueryRemoteServer_633_79_80_234_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">3</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(</span><span style="color: #800000;">"</span><span style="color: #800000;">localhost</span><span style="color: #800000;">"</span><span style="color: #000000;">, port, user, password); </span><span style="color: #008080;">4</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> ListResult(client.Get(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">null</span><span style="color: #000000;">))); </span><span style="color: #008080;">5</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client.Close(); </span><span style="color: #008080;">6</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">ClientServerExample.vb: <span class="fscMemberName">QueryRemoteServer</span></span></div><div class="fscCode"><pre ID="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_QueryRemoteServer_776_79"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">1</span><img id="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_QueryRemoteServer_776_79_14_305_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_QueryRemoteServer_776_79_14_305_Open_Text').style.display='none'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_QueryRemoteServer_776_79_14_305_Closed_Image').style.display='inline'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_QueryRemoteServer_776_79_14_305_Closed_Text').style.display='inline';"/><img id="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_QueryRemoteServer_776_79_14_305_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_QueryRemoteServer_776_79_14_305_Closed_Text').style.display='none'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_QueryRemoteServer_776_79_14_305_Open_Image').style.display='inline'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_QueryRemoteServer_776_79_14_305_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_QueryRemoteServer_776_79_14_305_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub QueryRemoteServer()</span><span id="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_QueryRemoteServer_776_79_14_305_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> QueryRemoteServer(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> port </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: #0000FF;">ByVal</span><span style="color: #000000;"> user </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: #0000FF;">ByVal</span><span style="color: #000000;"> password </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;">2</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(</span><span style="color: #800000;">"</span><span style="color: #800000;">localhost</span><span style="color: #800000;">"</span><span style="color: #000000;">, port, user, password) </span><span style="color: #008080;">3</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> ListResult(client.Get(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">Nothing</span><span style="color: #000000;">))) </span><span style="color: #008080;">4</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client.Close() </span><span style="color: #008080;">5</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> </span> <p>Everything else is absolutely identical to the <a href="../embedded.html" class="wikiLink">local server examples</a>.</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">ClientServerExample.cs: <span class="fscMemberName">DemonstrateRemoteReadCommitted</span></span></div><div class="fscCode"><pre ID="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteReadCommitted_1022_92"><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;"> DemonstrateRemoteReadCommitted(</span><span style="color: #0000FF;">int</span><span style="color: #000000;"> port, </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> user, </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> password) </span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteReadCommitted_1022_92_93_685_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteReadCommitted_1022_92_93_685_Open_Text').style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteReadCommitted_1022_92_93_685_Closed_Image').style.display='inline'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteReadCommitted_1022_92_93_685_Closed_Text').style.display='inline';"/><img id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteReadCommitted_1022_92_93_685_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteReadCommitted_1022_92_93_685_Closed_Text').style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteReadCommitted_1022_92_93_685_Open_Image').style.display='inline'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteReadCommitted_1022_92_93_685_Open_Text').style.display='inline';"/> </span><span id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteReadCommitted_1022_92_93_685_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteReadCommitted_1022_92_93_685_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"/> IObjectContainer client1 </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenClient(</span><span style="color: #800000;">"</span><span style="color: #800000;">localhost</span><span style="color: #800000;">"</span><span style="color: #000000;">, port, user, password); </span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectContainer client2 </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenClient(</span><span style="color: #800000;">"</span><span style="color: #800000;">localhost</span><span style="color: #800000;">"</span><span style="color: #000000;">, port, user, password); </span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> Pilot pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Jenson Button</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #800080;">97</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"/> IObjectSet result </span><span style="color: #000000;">=</span><span style="color: #000000;"> client1.Get(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">null</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"/> Car car </span><span style="color: #000000;">=</span><span style="color: #000000;"> (Car)result.Next(); </span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car.Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> pilot; </span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client1.Set(car); </span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> ListResult(client1.Get(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">null</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"/> ListResult(client2.Get(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">null</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"/> client1.Commit(); </span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> ListResult(client1.Get(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">null</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"/> ListResult(client2.Get(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">null</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"/> client1.Close(); </span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client2.Close(); </span><span style="color: #008080;">17</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">ClientServerExample.vb: <span class="fscMemberName">DemonstrateRemoteReadCommitted</span></span></div><div class="fscCode"><pre ID="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteReadCommitted_1178_92"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteReadCommitted_1178_92_14_896_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteReadCommitted_1178_92_14_896_Open_Text').style.display='none'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteReadCommitted_1178_92_14_896_Closed_Image').style.display='inline'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteReadCommitted_1178_92_14_896_Closed_Text').style.display='inline';"/><img id="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteReadCommitted_1178_92_14_896_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteReadCommitted_1178_92_14_896_Closed_Text').style.display='none'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteReadCommitted_1178_92_14_896_Open_Image').style.display='inline'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteReadCommitted_1178_92_14_896_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteReadCommitted_1178_92_14_896_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub DemonstrateRemoteReadCommitted()</span><span id="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteReadCommitted_1178_92_14_896_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> DemonstrateRemoteReadCommitted(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> port </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: #0000FF;">ByVal</span><span style="color: #000000;"> user </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: #0000FF;">ByVal</span><span style="color: #000000;"> password </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;">02</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;"> client1 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenClient(</span><span style="color: #800000;">"</span><span style="color: #800000;">localhost</span><span style="color: #800000;">"</span><span style="color: #000000;">, port, user, password) </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;"> client2 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenClient(</span><span style="color: #800000;">"</span><span style="color: #800000;">localhost</span><span style="color: #800000;">"</span><span style="color: #000000;">, port, user, password) </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;">Dim</span><span style="color: #000000;"> pilot </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Jenson Button</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #800080;">97</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;"> result </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectSet </span><span style="color: #000000;">=</span><span style="color: #000000;"> client1.Get(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">Nothing</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;">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;">DirectCast</span><span style="color: #000000;">(result.Next(), Car) </span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car.Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> pilot </span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client1.Set(car) </span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> ListResult(client1.Get(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">Nothing</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"/> ListResult(client2.Get(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">Nothing</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"/> client1.Commit() </span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> ListResult(client1.Get(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">Nothing</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"/> ListResult(client2.Get(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">Nothing</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"/> client1.Close() </span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client2.Close() </span><span style="color: #008080;">16</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> </span> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">ClientServerExample.cs: <span class="fscMemberName">DemonstrateRemoteRollback</span></span></div><div class="fscCode"><pre ID="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteRollback_1338_87"><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;"> DemonstrateRemoteRollback(</span><span style="color: #0000FF;">int</span><span style="color: #000000;"> port, </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> user, </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> password) </span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteRollback_1338_87_88_689_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteRollback_1338_87_88_689_Open_Text').style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteRollback_1338_87_88_689_Closed_Image').style.display='inline'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteRollback_1338_87_88_689_Closed_Text').style.display='inline';"/><img id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteRollback_1338_87_88_689_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteRollback_1338_87_88_689_Closed_Text').style.display='none'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteRollback_1338_87_88_689_Open_Image').style.display='inline'; document.getElementById('....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteRollback_1338_87_88_689_Open_Text').style.display='inline';"/> </span><span id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteRollback_1338_87_88_689_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="....ClientserverCS.ZipsClientServerExample.Cs_ClientServerExample.Cs_DemonstrateRemoteRollback_1338_87_88_689_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"/> IObjectContainer client1 </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenClient(</span><span style="color: #800000;">"</span><span style="color: #800000;">localhost</span><span style="color: #800000;">"</span><span style="color: #000000;">, port, user, password); </span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectContainer client2 </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenClient(</span><span style="color: #800000;">"</span><span style="color: #800000;">localhost</span><span style="color: #800000;">"</span><span style="color: #000000;">, port, user, password); </span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectSet result </span><span style="color: #000000;">=</span><span style="color: #000000;"> client1.Get(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">null</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"/> Car car </span><span style="color: #000000;">=</span><span style="color: #000000;"> (Car)result.Next(); </span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car.Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Someone else</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #800080;">0</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"/> client1.Set(car); </span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> ListResult(client1.Get(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">null</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"/> ListResult(client2.Get(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">null</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"/> client1.Rollback(); </span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client1.Ext().Refresh(car,</span><span style="color: #800080;">2</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"/> ListResult(client1.Get(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">null</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"/> ListResult(client2.Get(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">null</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"/> client1.Close(); </span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client2.Close(); </span><span style="color: #008080;">17</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">ClientServerExample.vb: <span class="fscMemberName">DemonstrateRemoteRollback</span></span></div><div class="fscCode"><pre ID="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteRollback_1489_87"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteRollback_1489_87_14_894_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteRollback_1489_87_14_894_Open_Text').style.display='none'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteRollback_1489_87_14_894_Closed_Image').style.display='inline'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteRollback_1489_87_14_894_Closed_Text').style.display='inline';"/><img id="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteRollback_1489_87_14_894_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteRollback_1489_87_14_894_Closed_Text').style.display='none'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteRollback_1489_87_14_894_Open_Image').style.display='inline'; document.getElementById('....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteRollback_1489_87_14_894_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteRollback_1489_87_14_894_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub DemonstrateRemoteRollback()</span><span id="....ClientserverVB.ZipsClientServerExample.Vb_ClientServerExample.Vb_DemonstrateRemoteRollback_1489_87_14_894_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> DemonstrateRemoteRollback(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> port </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: #0000FF;">ByVal</span><span style="color: #000000;"> user </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: #0000FF;">ByVal</span><span style="color: #000000;"> password </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;">02</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;"> client1 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenClient(</span><span style="color: #800000;">"</span><span style="color: #800000;">localhost</span><span style="color: #800000;">"</span><span style="color: #000000;">, port, user, password) </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;"> client2 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenClient(</span><span style="color: #800000;">"</span><span style="color: #800000;">localhost</span><span style="color: #800000;">"</span><span style="color: #000000;">, port, user, password) </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;">Dim</span><span style="color: #000000;"> result </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectSet </span><span style="color: #000000;">=</span><span style="color: #000000;"> client1.Get(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">Nothing</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;"> 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;">DirectCast</span><span style="color: #000000;">(result.Next(), Car) </span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car.Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Someone else</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #800080;">0</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"/> client1.Set(car) </span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> ListResult(client1.Get(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">Nothing</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"/> ListResult(client2.Get(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">Nothing</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"/> client1.Rollback() </span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client1.Ext().Refresh(car, </span><span style="color: #800080;">2</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"/> ListResult(client1.Get(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">Nothing</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"/> ListResult(client2.Get(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">Nothing</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"/> client1.Close() </span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client2.Close() </span><span style="color: #008080;">16</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> </span></div> </div> <div id="footer"> This revision (11) was last Modified 2007-09-15T14:40:38 by Tetyana. </div> </body> </html>