// This example shows all information available about OPC servers.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.
using System;
using OpcLabs.EasyOpc;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.OperationModel;
namespace DocExamples._ServerElement
{
class General
{
public static void Main1()
{
// Instantiate the client object.
var client = new EasyDAClient();
ServerElementCollection serverElements;
try
{
serverElements = client.BrowseServers();
}
catch (OpcException opcException)
{
Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
return;
}
foreach (ServerElement serverElement in serverElements)
{
Console.WriteLine($"Information about server \"{serverElement}\":");
Console.WriteLine($" .ServerClass: {serverElement.ServerClass}");
Console.WriteLine($" .ClsidString: {serverElement.ClsidString}");
Console.WriteLine($" .ProgId: {serverElement.ProgId}");
Console.WriteLine($" .Description: {serverElement.Description}");
Console.WriteLine($" .Vendor: {serverElement.Vendor}");
Console.WriteLine($" .ServerCategories: {serverElement.ServerCategories}");
Console.WriteLine($" .VersionIndependentProgId: {serverElement.VersionIndependentProgId}");
}
// Example output:
//
//Information about server "opcda:OPCLabs.KitServer.2%7Bc8a12f17-1e03-401e-b53d-6c654dd576da%7D":
// .ServerClass: OPCLabs.KitServer.2
// .ClsidString: c8a12f17-1e03-401e-b53d-6c654dd576da
// .ProgId: OPCLabs.KitServer.2
// .Description: OPC Labs Kit Server
// .Vendor: OPC Labs, http://www.opclabs.com
// .ServerCategories: (OpcDataAccess10, OpcDataAccess20, OpcDataAccess30)
// .VersionIndependentProgId: OPCLabs.KitServer
}
}
}
' This example shows all information available about OPC servers.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
' OPC client and subscriber examples in VB.NET on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBNET .
' Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
' a commercial license in order to use Online Forums, and we reply to every post.
Imports OpcLabs.EasyOpc
Imports OpcLabs.EasyOpc.DataAccess
Imports OpcLabs.EasyOpc.OperationModel
Namespace _ServerElement
Partial Friend Class General
Shared Sub Main1()
' Instantiate the client object.
Dim client = New EasyDAClient()
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 In serverElements
Console.WriteLine($"Information about server ""{serverElement}"":")
Console.WriteLine($" .ServerClass: {serverElement.ServerClass}")
Console.WriteLine($" .ClsidString: {serverElement.ClsidString}")
Console.WriteLine($" .ProgId: {serverElement.ProgId}")
Console.WriteLine($" .Description: {serverElement.Description}")
Console.WriteLine($" .Vendor: {serverElement.Vendor}")
Console.WriteLine($" .ServerCategories: {serverElement.ServerCategories}")
Console.WriteLine($" .VersionIndependentProgId: {serverElement.VersionIndependentProgId}")
Next serverElement
End Sub
' Example output
'
'Information about server "opcda:OPCLabs.KitServer.2%7Bc8a12f17-1e03-401e-b53d-6c654dd576da%7D":
' .ServerClass OPCLabs.KitServer.2
' .ClsidString: c8a12f17-1e03-401e-b53d-6c654dd576da
' .ProgId: OPCLabs.KitServer.2
' .Description: OPC Labs Kit Server
' .Vendor: OPC Labs, http : 'www.opclabs.com
' .ServerCategories: (OpcDataAccess10, OpcDataAccess20, OpcDataAccess30)
' .VersionIndependentProgId: OPCLabs.KitServer
End Class
End Namespace
Rem This example shows all information available about OPC servers.
Rem
Rem Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
Rem OPC client and subscriber examples in VBScript on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBScript .
Rem Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
Rem a commercial license in order to use Online Forums, and we reply to every post.
Option Explicit
Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.DataAccess.EasyDAClient")
On Error Resume Next
Dim ServerElements: Set ServerElements = Client.BrowseServers("")
If Err.Number <> 0 Then
WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
WScript.Quit
End If
On Error Goto 0
Dim ServerElement: For Each ServerElement In ServerElements
WScript.Echo "Information about server """ & ServerElement & """:"
With ServerElement
WScript.Echo Space(4) & ".ServerClass: " & .ServerClass
WScript.Echo Space(4) & ".ClsidString: " & .ClsidString
WScript.Echo Space(4) & ".ProgId: " & .ProgId
WScript.Echo Space(4) & ".Description: " & .Description
WScript.Echo Space(4) & ".Vendor: " & .Vendor
WScript.Echo Space(4) & ".ServerCategories.ToString(): " & .ServerCategories.ToString()
WScript.Echo Space(4) & ".VersionIndependentProgId: " & .VersionIndependentProgId
End With
Next
# This example shows all information available about OPC servers.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
# a commercial license in order to use Online Forums, and we reply to every post.
# 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()
try:
serverElements = IEasyDAClientExtension.BrowseServers(client)
except OpcException as opcException:
print('*** Failure: ' + opcException.GetBaseException().Message)
exit()
# Display results
for serverElement in serverElements:
print('Information about server ', serverElement, ':', sep='')
print(' .ServerClass: ', serverElement.ServerClass, sep='')
print(' .ClsidString: ', serverElement.ClsidString, sep='')
print(' .ProgId: ', serverElement.ProgId, sep='')
print(' .Description: ', serverElement.Description, sep='')
print(' .Vendor: ', serverElement.Vendor, sep='')
print(' .ServerCategories: ', serverElement.ServerCategories, sep='')
print(' .VersionIndependentProgId: ', serverElement.VersionIndependentProgId, sep='')