//-
        #endregion

        /// <summary>
        /// Browses all the servers that support a specified interface specification.
        ///	The server information to be returned after browsing is specified using the <see cref="EnumServerBrowserData"/> object.
        /// After browsing, a list of <see cref="ServerBrowserData"/> objects that contain the requested information will be returned.
        /// </summary>
        /// <param name="whatOPCspecification">An OPC specification.</param>
        /// <param name="whatServerData">Indicates what information about the server to be returned.</param>
        /// <param name="serverData">A list with requested information about the available servers on the computer.</param>
        /// <param name="someExecutionOptions">Specifies the modality of execution for browsing servers on the computer.</param>
        /// <returns>The result of browsing servers on the computer.
        /// </returns>
        /// <include
        ///  file='TBNC.doc.xml'
        ///  path='//class[@name="ServerBrowser"]/method[@name="Browse"]/doc/*'
        /// />
        public virtual int Browse(
            EnumOPCSpecification whatOPCspecification,
            EnumServerBrowserData whatServerData,
            out ServerBrowserData[] serverData,
            ExecutionOptions someExecutionOptions)
        {
            int res = (int)EnumResultCode.E_FAIL;

            serverData = null;
            try
            {
                byte   whatSpecification = (byte)whatOPCspecification;
                byte   whatData          = (byte)whatServerData;
                uint   serverDataCount   = 0;
                IntPtr pServerData       = new IntPtr();

                OTCExecutionOptions options = new OTCExecutionOptions();

                if (someExecutionOptions != null)
                {
                    options.m_executionType    = (byte)someExecutionOptions.ExecutionType;
                    options.m_executionContext = (uint)someExecutionOptions.ExecutionContext;
                }
                else
                {
                    options.m_executionType    = (byte)EnumExecutionType.SYNCHRONOUS;
                    options.m_executionContext = 0;
                }

                res = OTBFunctions.OTCBrowseServer(
                    m_ipAddress,
                    whatSpecification,
                    whatData,
                    ref serverDataCount,
                    out pServerData,
                    ref options);
                if (someExecutionOptions.ExecutionType == EnumExecutionType.SYNCHRONOUS)
                {
                    if (ResultCode.SUCCEEDED(res))
                    {
                        uint dataCount = serverDataCount;
                        serverData = new ServerBrowserData[dataCount];
                        OTCServerData[] serverDataOTC    = new OTCServerData[dataCount];
                        OTCServerData   typeOfServerData = new OTCServerData();
                        for (int i = 0; i < dataCount; i++)
                        {
                            int           structSize = Marshal.SizeOf(typeOfServerData);
                            OTCServerData myData     =
                                (OTCServerData)
                                Marshal.PtrToStructure(OTBFunctions.GetIntPtrOffset(pServerData, structSize * i), typeof(OTCServerData));
                            serverData[i] = new ServerBrowserData(
                                Marshal.PtrToStringUni(myData.m_clsid),
                                Marshal.PtrToStringUni(myData.m_progId),
                                Marshal.PtrToStringUni(myData.m_description),
                                Marshal.PtrToStringUni(myData.m_vProgId),
                                (EnumOPCSpecification)myData.m_opcSpecification,
                                Marshal.PtrToStringUni(myData.m_url));

                            OTBFunctions.OTFreeMemory(myData.m_clsid);

                            OTBFunctions.OTFreeMemory(myData.m_progId);

                            OTBFunctions.OTFreeMemory(myData.m_description);

                            OTBFunctions.OTFreeMemory(myData.m_vProgId);

                            OTBFunctions.OTFreeMemory(myData.m_url);
                        }                         //	end for

                        OTBFunctions.OTFreeMemory(pServerData);
                    }             //	end if
                }                 //	end if
            }
            catch (Exception exc)
            {
                Application.Instance.Trace(
                    EnumTraceLevel.ERR,
                    EnumTraceGroup.CLIENT,
                    "ServerBrowser.Browse",
                    exc.ToString());
            }
            return(res);
        }