<html> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Controlling Login Information</title> <link rel="stylesheet" type="text/css" href="../../../style.css"> </head> <body> <div class="CommonContent"> <div class="CommonContentArea"> <h1>Controlling Login Information</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> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">ConnectedUser.cs</span></div><div class="fscCode"><pre ID="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">001</span><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_0_67_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_0_67_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_0_67_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_0_67_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_0_67_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_0_67_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_0_67_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_0_67_Open_Text').style.display='inline';"/><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_0_67_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">/**/</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_0_67_Open_Text"><span style="color: #008000;">/*</span><span style="color: #008000;"> Copyright (C) 2004 - 2007 db4objects Inc. </span><span style="color: #008000; text-decoration: underline;">http://www.db4o.com</span><span style="color: #008000;"> </span><span style="color: #008000;">*/</span></span><span style="color: #000000;"> </span><span style="color: #008080;">002</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;"> System; </span><span style="color: #008080;">003</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;"> System.Collections; </span><span style="color: #008080;">004</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;">005</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;">006</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.Ext; </span><span style="color: #008080;">007</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.Query; </span><span style="color: #008080;">008</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/> </span><span style="color: #008080;">009</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/> </span><span style="color: #008080;">010</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.Semaphores </span><span style="color: #008080;">011</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_259_3450_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_259_3450_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_259_3450_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_259_3450_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_259_3450_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_259_3450_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_259_3450_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_259_3450_Open_Text').style.display='inline';"/></span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_259_3450_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_259_3450_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">012</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">013</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_263_586_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_263_586_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_263_586_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_263_586_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_263_586_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_263_586_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_263_586_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_263_586_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_263_586_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">/**/</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_263_586_Open_Text"><span style="color: #008000;">/*</span><span style="color: #008000;">* </span><span style="color: #008080;">014</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> * This class demonstrates how semaphores can be used </span><span style="color: #008080;">015</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> * to rule out race conditions when providing exact and </span><span style="color: #008080;">016</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> * up-to-date information about all connected clients </span><span style="color: #008080;">017</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> * on a server. The class also can be used to make sure </span><span style="color: #008080;">018</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> * that only one login is possible with a give user name </span><span style="color: #008080;">019</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> * and ipAddress combination. </span><span style="color: #008080;">020</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #008000;">*/</span></span><span style="color: #000000;"> </span><span style="color: #008080;">021</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;"> ConnectedUser </span><span style="color: #008080;">022</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_617_3448_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_617_3448_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_617_3448_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_617_3448_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_617_3448_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_617_3448_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_617_3448_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_617_3448_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_617_3448_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_617_3448_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">023</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">024</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;">const</span><span style="color: #000000;"> </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> SemaphoreConnected </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">ConnectedUser_</span><span style="color: #800000;">"</span><span style="color: #000000;">; </span><span style="color: #008080;">025</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;">const</span><span style="color: #000000;"> </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> SemaphoreLockAccess </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">ConnectedUser_Lock_</span><span style="color: #800000;">"</span><span style="color: #000000;">; </span><span style="color: #008080;">026</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">027</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;">const</span><span style="color: #000000;"> </span><span style="color: #0000FF;">int</span><span style="color: #000000;"> Timeout </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">10000</span><span style="color: #000000;">; </span><span style="color: #008000;">//</span><span style="color: #008000;"> concurrent access timeout 10 seconds</span><span style="color: #008000;"> </span><span style="color: #008080;">028</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;">029</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> String userName; </span><span style="color: #008080;">030</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> String ipAddress; </span><span style="color: #008080;">031</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">032</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;"> ConnectedUser(String userName, String ipAddress) </span><span style="color: #008080;">033</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_949_1014_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_949_1014_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_949_1014_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_949_1014_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_949_1014_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_949_1014_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_949_1014_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_949_1014_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_949_1014_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_949_1014_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">034</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;">.userName </span><span style="color: #000000;">=</span><span style="color: #000000;"> userName; </span><span style="color: #008080;">035</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;">.ipAddress </span><span style="color: #000000;">=</span><span style="color: #000000;"> ipAddress; </span><span style="color: #008080;">036</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;">037</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">038</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;"> make sure to call this on the server before opening the database </span><span style="color: #008080;">039</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008000;">//</span><span style="color: #008000;"> to improve querying speed </span><span style="color: #008000;"> </span><span style="color: #008080;">040</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;">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;"> Configure() </span><span style="color: #008080;">041</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1157_1362_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1157_1362_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1157_1362_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1157_1362_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1157_1362_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1157_1362_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1157_1362_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1157_1362_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1157_1362_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1157_1362_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">042</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectClass objectClass </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.Configure().ObjectClass(</span><span style="color: #0000FF;">typeof</span><span style="color: #000000;">(ConnectedUser)); </span><span style="color: #008080;">043</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> objectClass.ObjectField(</span><span style="color: #800000;">"</span><span style="color: #800000;">userName</span><span style="color: #800000;">"</span><span style="color: #000000;">).Indexed(</span><span style="color: #0000FF;">true</span><span style="color: #000000;">); </span><span style="color: #008080;">044</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> objectClass.ObjectField(</span><span style="color: #800000;">"</span><span style="color: #800000;">ipAddress</span><span style="color: #800000;">"</span><span style="color: #000000;">).Indexed(</span><span style="color: #0000FF;">true</span><span style="color: #000000;">); </span><span style="color: #008080;">045</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;">046</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">047</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;"> call this on the client to ensure to have a ConnectedUser record </span><span style="color: #008080;">048</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008000;">//</span><span style="color: #008000;"> in the database file and the semaphore set</span><span style="color: #008000;"> </span><span style="color: #008080;">049</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;">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;"> Login(IObjectContainer client, String userName, String ipAddress) </span><span style="color: #008080;">050</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1576_2346_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1576_2346_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1576_2346_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1576_2346_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1576_2346_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1576_2346_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1576_2346_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1576_2346_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1576_2346_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1576_2346_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">051</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (</span><span style="color: #000000;">!</span><span style="color: #000000;">client.Ext().SetSemaphore(SemaphoreLockAccess, Timeout)) </span><span style="color: #008080;">052</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1655_1740_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1655_1740_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1655_1740_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1655_1740_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1655_1740_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1655_1740_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1655_1740_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1655_1740_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1655_1740_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1655_1740_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">053</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">throw</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Exception(</span><span style="color: #800000;">"</span><span style="color: #800000;">Timeout trying to get access to ConnectedUser lock</span><span style="color: #800000;">"</span><span style="color: #000000;">); </span><span style="color: #008080;">054</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;">055</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IQuery q </span><span style="color: #000000;">=</span><span style="color: #000000;"> client.Query(); </span><span style="color: #008080;">056</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> q.Constrain(</span><span style="color: #0000FF;">typeof</span><span style="color: #000000;">(ConnectedUser)); </span><span style="color: #008080;">057</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> q.Descend(</span><span style="color: #800000;">"</span><span style="color: #800000;">userName</span><span style="color: #800000;">"</span><span style="color: #000000;">).Constrain(userName); </span><span style="color: #008080;">058</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> q.Descend(</span><span style="color: #800000;">"</span><span style="color: #800000;">ipAddress</span><span style="color: #800000;">"</span><span style="color: #000000;">).Constrain(ipAddress); </span><span style="color: #008080;">059</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">if</span><span style="color: #000000;">(q.Execute().Size() </span><span style="color: #000000;">==</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;">) </span><span style="color: #008080;">060</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1938_2021_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1938_2021_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1938_2021_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1938_2021_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1938_2021_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1938_2021_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1938_2021_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1938_2021_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1938_2021_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_1938_2021_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">061</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client.Set(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> ConnectedUser(userName, ipAddress)); </span><span style="color: #008080;">062</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client.Commit(); </span><span style="color: #008080;">063</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;">064</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> String connectedSemaphoreName </span><span style="color: #000000;">=</span><span style="color: #000000;"> SemaphoreConnected </span><span style="color: #000000;">+</span><span style="color: #000000;"> userName </span><span style="color: #000000;">+</span><span style="color: #000000;"> ipAddress; </span><span style="color: #008080;">065</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">bool</span><span style="color: #000000;"> unique </span><span style="color: #000000;">=</span><span style="color: #000000;"> client.Ext().SetSemaphore(connectedSemaphoreName, </span><span style="color: #800080;">0</span><span style="color: #000000;">); </span><span style="color: #008080;">066</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client.Ext().ReleaseSemaphore(SemaphoreLockAccess); </span><span style="color: #008080;">067</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">if</span><span style="color: #000000;">(</span><span style="color: #000000;">!</span><span style="color: #000000;"> unique) </span><span style="color: #008080;">068</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2263_2342_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2263_2342_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2263_2342_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2263_2342_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2263_2342_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2263_2342_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2263_2342_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2263_2342_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2263_2342_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2263_2342_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">069</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">throw</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Exception(</span><span style="color: #800000;">"</span><span style="color: #800000;">Two clients with same userName and ipAddress</span><span style="color: #800000;">"</span><span style="color: #000000;">); </span><span style="color: #008080;">070</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;">071</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;">072</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">073</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 your list of all connected users, callable on the server</span><span style="color: #008000;"> </span><span style="color: #008080;">074</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;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> IList ConnectedUsers(IObjectServer server) </span><span style="color: #008080;">075</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2483_3445_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2483_3445_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2483_3445_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2483_3445_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2483_3445_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2483_3445_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2483_3445_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2483_3445_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2483_3445_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2483_3445_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">076</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IExtObjectContainer serverObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> server.Ext().ObjectContainer().Ext(); </span><span style="color: #008080;">077</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (serverObjectContainer.SetSemaphore(SemaphoreLockAccess, Timeout)) </span><span style="color: #008080;">078</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2655_2740_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2655_2740_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2655_2740_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2655_2740_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2655_2740_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2655_2740_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2655_2740_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2655_2740_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2655_2740_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2655_2740_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">079</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">throw</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Exception(</span><span style="color: #800000;">"</span><span style="color: #800000;">Timeout trying to get access to ConnectedUser lock</span><span style="color: #800000;">"</span><span style="color: #000000;">); </span><span style="color: #008080;">080</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;">081</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IList list </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> ArrayList(); </span><span style="color: #008080;">082</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IQuery q </span><span style="color: #000000;">=</span><span style="color: #000000;"> serverObjectContainer.Query(); </span><span style="color: #008080;">083</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> q.Constrain(</span><span style="color: #0000FF;">typeof</span><span style="color: #000000;">(ConnectedUser)); </span><span style="color: #008080;">084</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectSet objectSet </span><span style="color: #000000;">=</span><span style="color: #000000;"> q.Execute(); </span><span style="color: #008080;">085</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">while</span><span style="color: #000000;">(objectSet.HasNext()) </span><span style="color: #008080;">086</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2930_3317_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2930_3317_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2930_3317_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2930_3317_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2930_3317_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2930_3317_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2930_3317_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2930_3317_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2930_3317_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_2930_3317_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">087</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> ConnectedUser connectedUser </span><span style="color: #000000;">=</span><span style="color: #000000;"> (ConnectedUser)objectSet.Next(); </span><span style="color: #008080;">088</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> String connectedSemaphoreName </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #008080;">089</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> SemaphoreConnected </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #008080;">090</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> connectedUser.userName </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #008080;">091</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> connectedUser.ipAddress; </span><span style="color: #008080;">092</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">if</span><span style="color: #000000;">(serverObjectContainer.SetSemaphore(connectedSemaphoreName, Timeout)) </span><span style="color: #008080;">093</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3204_3261_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3204_3261_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3204_3261_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3204_3261_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3204_3261_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3204_3261_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3204_3261_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3204_3261_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3204_3261_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3204_3261_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">094</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> serverObjectContainer.Delete(connectedUser); </span><span style="color: #008080;">095</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;">096</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">else</span><span style="color: #000000;"> </span><span style="color: #008080;">097</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3275_3312_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3275_3312_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3275_3312_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3275_3312_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3275_3312_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3275_3312_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3275_3312_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3275_3312_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3275_3312_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresCS.ZipsConnectedUser.Cs_ConnectedUser.Cs_53_47_3275_3312_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">098</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> list.Add(connectedUser); </span><span style="color: #008080;">099</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;">100</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;">101</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> serverObjectContainer.Commit(); </span><span style="color: #008080;">102</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> serverObjectContainer.ReleaseSemaphore(SemaphoreLockAccess); </span><span style="color: #008080;">103</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;"> list; </span><span style="color: #008080;">104</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;">105</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;">106</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">ConnectedUser.vb</span></div><div class="fscCode"><pre ID="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47"><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;"> System.Collections </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 </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.Config </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;">Imports</span><span style="color: #000000;"> Db4objects.Db4o.Ext </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: #0000FF;">Imports</span><span style="color: #000000;"> Db4objects.Db4o.Query </span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/> </span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/> </span><span style="color: #008080;">10</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_222_4114_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_222_4114_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_222_4114_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_222_4114_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_222_4114_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_222_4114_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_222_4114_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_222_4114_Open_Text').style.display='inline';"/></span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_222_4114_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Namespace Db4objects</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_222_4114_Open_Text"><span style="color: #0000FF;">Namespace</span><span style="color: #000000;"> Db4objects.Db4odoc.Semaphores </span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008000;">'</span><span style="color: #008000;"> </span><span style="color: #008000;"> </span><span style="color: #008080;">12</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #008000;">'</span><span style="color: #008000;"> This class demonstrates how semaphores can be used </span><span style="color: #008000;"> </span><span style="color: #008080;">13</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #008000;">'</span><span style="color: #008000;"> to rule race conditions when providing exact and</span><span style="color: #008000;"> </span><span style="color: #008080;">14</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #008000;">'</span><span style="color: #008000;"> up-to-date information about all connected clients </span><span style="color: #008000;"> </span><span style="color: #008080;">15</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #008000;">'</span><span style="color: #008000;"> on a server. The class also can be used to make sure</span><span style="color: #008000;"> </span><span style="color: #008080;">16</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #008000;">'</span><span style="color: #008000;"> that only one login is possible with a give user name</span><span style="color: #008000;"> </span><span style="color: #008080;">17</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #008000;">'</span><span style="color: #008000;"> and ipAddress combination.</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: #008000;">'</span><span style="color: #008000;"> </span><span style="color: #008000;"> </span><span style="color: #008080;">19</span><span style="color: #008000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_632_4100_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_632_4100_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_632_4100_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_632_4100_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_632_4100_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_632_4100_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_632_4100_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_632_4100_Open_Text').style.display='inline';"/></span><span style="color: #000000;"> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_632_4100_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Class ConnectedUser</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_632_4100_Open_Text"><span style="color: #0000FF;">Class</span><span style="color: #000000;"> ConnectedUser </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: #008080;">21</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;">Shared</span><span style="color: #000000;"> </span><span style="color: #0000FF;">ReadOnly</span><span style="color: #000000;"> SemaphoreConnected </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;">ConnectedUser_</span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #008080;">22</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;">Shared</span><span style="color: #000000;"> </span><span style="color: #0000FF;">ReadOnly</span><span style="color: #000000;"> SemaphoreLockAccess </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;">ConnectedUser_Lock_</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"/> </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;">Public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span style="color: #0000FF;">ReadOnly</span><span style="color: #000000;"> Timeout </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: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">10000</span><span style="color: #000000;"> </span><span style="color: #008000;">'</span><span style="color: #008000;"> concurrent access timeout 10 seconds</span><span style="color: #008000;"> </span><span style="color: #008080;">25</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;">26</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;"> userName </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;">27</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;"> ipAddress </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;">28</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">29</span><span style="color: #000000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_996_1144_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_996_1144_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_996_1144_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_996_1144_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_996_1144_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_996_1144_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_996_1144_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_996_1144_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_996_1144_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub New()</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_996_1144_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;"> userName </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;"> ipAddress </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;">30</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;">.userName </span><span style="color: #000000;">=</span><span style="color: #000000;"> userName </span><span style="color: #008080;">31</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;">.ipAddress </span><span style="color: #000000;">=</span><span style="color: #000000;"> ipAddress </span><span style="color: #008080;">32</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;">33</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </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;"> make sure to call this on the server before opening the database</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;"> </span><span style="color: #008000;">'</span><span style="color: #008000;"> to improve querying speed </span><span style="color: #008000;"> </span><span style="color: #008080;">36</span><span style="color: #008000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1280_1542_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1280_1542_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1280_1542_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1280_1542_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1280_1542_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1280_1542_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1280_1542_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1280_1542_Open_Text').style.display='inline';"/></span><span style="color: #000000;"> </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-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1280_1542_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub Configure()</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1280_1542_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> Configure() </span><span style="color: #008080;">37</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;"> objectClass </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectClass </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.Configure().ObjectClass(</span><span style="color: #0000FF;">GetType</span><span style="color: #000000;">(ConnectedUser)) </span><span style="color: #008080;">38</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> objectClass.ObjectField(</span><span style="color: #800000;">"</span><span style="color: #800000;">userName</span><span style="color: #800000;">"</span><span style="color: #000000;">).Indexed(</span><span style="color: #0000FF;">True</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"/> objectClass.ObjectField(</span><span style="color: #800000;">"</span><span style="color: #800000;">ipAddress</span><span style="color: #800000;">"</span><span style="color: #000000;">).Indexed(</span><span style="color: #0000FF;">True</span><span style="color: #000000;">) </span><span style="color: #008080;">40</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;">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: #008000;">'</span><span style="color: #008000;"> call this on the client to ensure to have a ConnectedUser record </span><span style="color: #008000;"> </span><span style="color: #008080;">43</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #008000;">'</span><span style="color: #008000;"> in the database file and the semaphore set</span><span style="color: #008000;"> </span><span style="color: #008080;">44</span><span style="color: #008000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1695_2739_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1695_2739_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1695_2739_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1695_2739_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1695_2739_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1695_2739_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1695_2739_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1695_2739_Open_Text').style.display='inline';"/></span><span style="color: #000000;"> </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-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1695_2739_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub Login()</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_1695_2739_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> Login(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> client </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer, </span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> userName </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;"> ipAddress </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;">45</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Not</span><span style="color: #000000;"> client.Ext().SetSemaphore(SemaphoreLockAccess, Timeout) </span><span style="color: #0000FF;">Then</span><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: #0000FF;">Throw</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Exception(</span><span style="color: #800000;">"</span><span style="color: #800000;">Timeout Trying to get access to ConnectedUser lock</span><span style="color: #800000;">"</span><span style="color: #000000;">) </span><span style="color: #008080;">47</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;">If</span><span style="color: #000000;"> </span><span style="color: #008080;">48</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;"> q </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IQuery </span><span style="color: #000000;">=</span><span style="color: #000000;"> client.Query() </span><span style="color: #008080;">49</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> q.Constrain(</span><span style="color: #0000FF;">GetType</span><span style="color: #000000;">(ConnectedUser)) </span><span style="color: #008080;">50</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> q.Descend(</span><span style="color: #800000;">"</span><span style="color: #800000;">userName</span><span style="color: #800000;">"</span><span style="color: #000000;">).Constrain(userName) </span><span style="color: #008080;">51</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> q.Descend(</span><span style="color: #800000;">"</span><span style="color: #800000;">ipAddress</span><span style="color: #800000;">"</span><span style="color: #000000;">).Constrain(ipAddress) </span><span style="color: #008080;">52</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> q.Execute().Size() </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Then</span><span style="color: #000000;"> </span><span style="color: #008080;">53</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client.Set(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> ConnectedUser(userName, ipAddress)) </span><span style="color: #008080;">54</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client.Commit() </span><span style="color: #008080;">55</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;">If</span><span style="color: #000000;"> </span><span style="color: #008080;">56</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;"> connectedSemaphoreName </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;"> SemaphoreConnected </span><span style="color: #000000;">+</span><span style="color: #000000;"> userName </span><span style="color: #000000;">+</span><span style="color: #000000;"> ipAddress </span><span style="color: #008080;">57</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;"> unique </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Boolean</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> client.Ext().SetSemaphore(connectedSemaphoreName, </span><span style="color: #800080;">0</span><span style="color: #000000;">) </span><span style="color: #008080;">58</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client.Ext().ReleaseSemaphore(SemaphoreLockAccess) </span><span style="color: #008080;">59</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Not</span><span style="color: #000000;"> unique </span><span style="color: #0000FF;">Then</span><span style="color: #000000;"> </span><span style="color: #008080;">60</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Throw</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Exception(</span><span style="color: #800000;">"</span><span style="color: #800000;">Two clients with same userName and ipAddress</span><span style="color: #800000;">"</span><span style="color: #000000;">) </span><span style="color: #008080;">61</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;">If</span><span style="color: #000000;"> </span><span style="color: #008080;">62</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;">63</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">64</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 your list of all connected users, callable on the server</span><span style="color: #008000;"> </span><span style="color: #008080;">65</span><span style="color: #008000;"><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_2838_4086_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_2838_4086_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_2838_4086_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_2838_4086_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_2838_4086_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_2838_4086_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_2838_4086_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_2838_4086_Open_Text').style.display='inline';"/></span><span style="color: #000000;"> </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-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_2838_4086_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Function ConnectedUsers()</span><span id="ResourcesReferenceClient-ServerSemaphoressemaphoresVB.ZipsConnectedUser.Vb_ConnectedUser.Vb_158_47_2838_4086_Open_Text"><span style="color: #0000FF;">Function</span><span style="color: #000000;"> ConnectedUsers(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> server </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectServer) </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IList </span><span style="color: #008080;">66</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;"> serverObjectContainer </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IExtObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> server.Ext().ObjectContainer().Ext() </span><span style="color: #008080;">67</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> serverObjectContainer.SetSemaphore(SemaphoreLockAccess, TIMEOUT) </span><span style="color: #0000FF;">Then</span><span style="color: #000000;"> </span><span style="color: #008080;">68</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Throw</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Exception(</span><span style="color: #800000;">"</span><span style="color: #800000;">Timeout Trying to get access to ConnectedUser lock</span><span style="color: #800000;">"</span><span style="color: #000000;">) </span><span style="color: #008080;">69</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;">If</span><span style="color: #000000;"> </span><span style="color: #008080;">70</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;"> list </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IList </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> ArrayList() </span><span style="color: #008080;">71</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;"> q </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IQuery </span><span style="color: #000000;">=</span><span style="color: #000000;"> serverObjectContainer.Query() </span><span style="color: #008080;">72</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> q.Constrain(</span><span style="color: #0000FF;">GetType</span><span style="color: #000000;">(ConnectedUser)) </span><span style="color: #008080;">73</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;"> objectSet </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectSet </span><span style="color: #000000;">=</span><span style="color: #000000;"> q.Execute() </span><span style="color: #008080;">74</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">While</span><span style="color: #000000;"> objectSet.HasNext() </span><span style="color: #008080;">75</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;"> connectedUser </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> ConnectedUser </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">CType</span><span style="color: #000000;">(objectSet.Next(), ConnectedUser) </span><span style="color: #008080;">76</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;"> connectedSemaphoreName </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;"> SemaphoreConnected </span><span style="color: #000000;">+</span><span style="color: #000000;"> connectedUser.userName </span><span style="color: #000000;">+</span><span style="color: #000000;"> connectedUser.ipAddress </span><span style="color: #008080;">77</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> serverObjectContainer.SetSemaphore(connectedSemaphoreName, TIMEOUT) </span><span style="color: #0000FF;">Then</span><span style="color: #000000;"> </span><span style="color: #008080;">78</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> serverObjectContainer.Delete(connectedUser) </span><span style="color: #008080;">79</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Else</span><span style="color: #000000;"> </span><span style="color: #008080;">80</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> list.Add(connectedUser) </span><span style="color: #008080;">81</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;">If</span><span style="color: #000000;"> </span><span style="color: #008080;">82</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;">While</span><span style="color: #000000;"> </span><span style="color: #008080;">83</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> serverObjectContainer.Commit() </span><span style="color: #008080;">84</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> serverObjectContainer.ReleaseSemaphore(SemaphoreLockAccess) </span><span style="color: #008080;">85</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;"> list </span><span style="color: #008080;">86</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;">87</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;">88</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></div> </div> <div id="footer"> This revision (5) was last Modified 2006-11-14T12:00:13 by Tetyana. </div> </body> </html>