// This example shows how to obtain all ProgIDs of all OPC Alarms and Events servers on the local machine.
using System;
using System.Diagnostics;
using OpcLabs.EasyOpc;
using OpcLabs.EasyOpc.AlarmsAndEvents;
using OpcLabs.EasyOpc.OperationModel;
namespace DocExamples.AlarmsAndEvents._EasyAEClient
{
class BrowseServers
{
public static void Main1()
{
// Instantiate the client object.
var client = new EasyAEClient();
ServerElementCollection serverElements;
try
{
serverElements = client.BrowseServers("");
}
catch (OpcException opcException)
{
Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
return;
}
foreach (ServerElement serverElement in serverElements)
{
Debug.Assert(serverElement != null);
Console.WriteLine("serverElements[\"{0}\"].ProgId: {1}", serverElement.Clsid, serverElement.ProgId);
}
}
}
}
# This example shows how to obtain all ProgIDs of all OPC Data Access servers on the local machine.
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc
# Import .NET namespaces.
from OpcLabs.EasyOpc.DataAccess import *
from OpcLabs.EasyOpc.OperationModel import *
# Instantiate the client object
client = EasyDAClient()
# Perform the operation
try:
serverElements = IEasyDAClientExtension.BrowseServers(client, '')
except OpcException as opcException:
print('*** Failure: ' + opcException.GetBaseException().Message)
exit()
# Display results
for serverElement in serverElements:
print('ServerElements("' + serverElement.ClsidString + '"): ' + serverElement.ProgId)
' This example shows how to obtain all ProgIDs of all OPC Alarms and Events servers on the local machine.
Imports OpcLabs.EasyOpc
Imports OpcLabs.EasyOpc.AlarmsAndEvents
Imports OpcLabs.EasyOpc.OperationModel
Namespace AlarmsAndEvents._EasyAEClient
Friend Class BrowseServers
Public Shared Sub Main1()
Dim client = New EasyAEClient()
Dim serverElements As ServerElementCollection
Try
serverElements = client.BrowseServers("")
Catch opcException As OpcException
Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
Exit Sub
End Try
For Each serverElement As ServerElement In serverElements
Debug.Assert(serverElement IsNot Nothing)
Console.WriteLine("serverElements[""{0}""].ProgId: {1}", serverElement.Clsid, serverElement.ProgId)
Next serverElement
End Sub
End Class
End Namespace