Skip to content

Reference

OpcServerBase Members

Provides the base class of OpcServer and OpcDiscoveryServer, which maintains the base addresses and the life cycle (see State) of a server.

Reference

OpcServerBase Members ​

Type
OpcServerBase
Namespace
Opc.UaFx.Server
Assembly
Opc.UaFx.Advanced.dll
Package
Opc.UaFx.Advanced v2.59.0

Inherits members from OpcApplicationInstance<OpcTransport, OpcServerSecurity>.

Constructors ​

OpcServerBase ​

protected · 3 overloads

OverloadDescription
OpcServerBase(OpcServerType)protectedInitializes a new instance of the OpcServerBase class using the type specified.
OpcServerBase(OpcServerType, string)protectedInitializes a new instance of the OpcServerBase class using the type and address specified.
OpcServerBase(OpcServerType, Uri)protectedInitializes a new instance of the OpcServerBase class using the type and address specified.

OpcServerBase(OpcServerType) ​

protected

Initializes a new instance of the OpcServerBase class using the type specified.

csharp
protected OpcServerBase(OpcServerType type)
vbnet
Protected Sub New(type As OpcServerType)

Parameters

NameTypeDescription
typeOpcServerTypeOne of the members defined by the OpcServerType enumeration which specifies the type of the server.

Exceptions

ExceptionCondition
LicenseExceptionThe license is expired.

OpcServerBase(OpcServerType, string) ​

protected

Initializes a new instance of the OpcServerBase class using the type and address specified.

csharp
protected OpcServerBase(OpcServerType type, string address)
vbnet
Protected Sub New(type As OpcServerType, address As String)

Parameters

NameTypeDescription
typeOpcServerTypeOne of the members defined by the OpcServerType enumeration which specifies the type of the server.
addressStringThe string representation of the address of the server which needs to use one of the supported schemes 'opc.tcp' and 'https'.

Exceptions

ExceptionCondition
ArgumentExceptionThe address is equals Empty or is not an absolute URI using one of the supported schemes 'opc.tcp' and 'https'.
ArgumentNullExceptionThe address is a null reference (Nothing in Visual Basic).

OpcServerBase(OpcServerType, Uri) ​

protected

Initializes a new instance of the OpcServerBase class using the type and address specified.

csharp
protected OpcServerBase(OpcServerType type, Uri address)
vbnet
Protected Sub New(type As OpcServerType, address As Uri)

Parameters

NameTypeDescription
typeOpcServerTypeOne of the members defined by the OpcServerType enumeration which specifies the type of the server.
addressUriThe Uri of the address of the server which needs to use one of the supported schemes 'opc.tcp' and 'https'.

Exceptions

ExceptionCondition
ArgumentExceptionThe address does not use one of the supported schemes 'opc.tcp' and 'https'.
ArgumentNullExceptionThe address is a null reference (Nothing in Visual Basic).

Properties ​

Address ​

Gets or sets the (first) base address of the server.

csharp
public Uri Address { get; set; }
vbnet
Public Property Address As Uri

Property value

Uri

The first Uri used by the server to listen and response to OPC UA requests or a null reference (Nothing in Visual Basic) in case there is no base address defined.

Exceptions

ExceptionCondition
ArgumentExceptionThe value is a null reference (Nothing in Visual Basic) or the address format / scheme can not be used as a server address.

Addresses ​

Gets a read-only collection of Uri instances representing the base addresses used by the server.

csharp
public ReadOnlyCollection<Uri> Addresses { get; }
vbnet
Public ReadOnly Property Addresses As ReadOnlyCollection(Of Uri)

Property value

ReadOnlyCollection<Uri>

A ReadOnlyCollection<T> of Uri instances used by the server to listen and response to OPC UA requests.

Remarks

To manage the different base addresses used use the RegisterAddress/RegisterAddress method to add an additional base address or use the UnregisterAddress/ UnregisterAddress method to remove a base address.

AuthenticationLimits ​

since v2.50

Gets the OpcAuthenticationLimits instance used to maintain the different authentication limits used by the server.

csharp
public OpcAuthenticationLimits AuthenticationLimits { get; }
vbnet
Public ReadOnly Property AuthenticationLimits As OpcAuthenticationLimits

Property value

OpcAuthenticationLimits

An instance of the OpcAuthenticationLimits class used by the application instance to setup and maintain the different authentication limits.

Binding ​

Gets the OpcServerBinding instance used to maintain the different binding options used by the server application.

csharp
public OpcServerBinding Binding { get; }
vbnet
Public ReadOnly Property Binding As OpcServerBinding

Property value

OpcServerBinding

An instance of the OpcServerBinding class used by the OpcServer to setup and maintain the different binding options.

Configuration ​

override

Gets or sets an instance of the OpcApplicationConfiguration class which is used as a low-level representation of the code/file based server application configuration.

csharp
[CLSCompliant(false)]
public override OpcApplicationConfiguration Configuration { get; set; }
vbnet
<CLSCompliant(False)>
Public Overrides Property Configuration As OpcApplicationConfiguration

Property value

OpcApplicationConfiguration

An instance of the OpcApplicationConfiguration class configured with the server specific setup to use. An assignment of a null reference (Nothing in Visual Basic) will lead to the creation of a new instance of the OpcApplicationConfiguration class with all defaults typically used by server applications.

Overrides

Configuration

Remarks

A file based OpcApplicationConfiguration needs to be loaded manually either using a specific config-section in its App.config (see LoadServerConfig) or using a custom file using LoadServerConfigFile. A low-level code based server configuration can be directly performed using an instance of the OpcApplicationConfiguration like the instance provided by this property. In case there is a different instance applied to this property the property will ensure that the Address property will represent the first base address configured in the base addresses of the passed configuration instance.

Name ​

Gets or sets the name of the server.

csharp
public string Name { get; set; }
vbnet
Public Property Name As String

Property value

String

The name of the server; by default a name derived from the type of the server. If the server is hosted as a Windows service, the name is used as the name of the service.

Namespaces ​

override · since v2.12

Gets a read-only collection of namespaces used by the server.

csharp
public override OpcReadOnlyNamespaceCollection Namespaces { get; }
vbnet
Public Overrides ReadOnly Property Namespaces As OpcReadOnlyNamespaceCollection

Property value

OpcReadOnlyNamespaceCollection

An instance of the OpcReadOnlyNamespaceCollection class with OpcNamespace items for each 'NamespaceUri' used by the server to organize the nodes in its address space.

Overrides

Namespaces

Remarks

The items in the OpcReadOnlyNamespaceCollection provided are created during the startup of the server.

State ​

Gets a value that indicates the current state of the server.

csharp
public OpcServerState State { get; }
vbnet
Public ReadOnly Property State As OpcServerState

Property value

OpcServerState

One of the members defined by the OpcServerState enumeration. Which specifies the current state of the server.

Methods ​

CreateAuthenticationLimits ​

protected · virtual · since v2.50

Creates a new instance of the OpcAuthenticationLimits class.

csharp
protected virtual OpcAuthenticationLimits CreateAuthenticationLimits()
vbnet
Protected Overridable Function CreateAuthenticationLimits() As OpcAuthenticationLimits

Returns

OpcAuthenticationLimits

A new instance of theOpcAuthenticationLimits class.

CreateConfiguration ​

protected · virtual

Creates the configuration which is used to start the server.

csharp
[CLSCompliant(false)]
protected virtual OpcApplicationConfiguration CreateConfiguration()
vbnet
<CLSCompliant(False)>
Protected Overridable Function CreateConfiguration() As OpcApplicationConfiguration

Returns

OpcApplicationConfiguration

A new instance of the OpcApplicationConfiguration class which copies the settings of the Configuration without its client configuration and without the configuration of the other type of server (see OpcServerType). Settings which are missing are completed using their defaults.

CreateSecurity ​

protected · override · since v2.6

Creates a new instance of the OpcServerSecurity class.

csharp
protected override sealed OpcServerSecurity CreateSecurity()
vbnet
Protected NotOverridable Overrides Function CreateSecurity() As OpcServerSecurity

Returns

OpcServerSecurity

A new instance of theOpcServerSecurity class.

Overrides

CreateSecurity()

CreateTransport ​

protected · override · since v2.6

Creates a new instance of the OpcTransport class.

csharp
protected override sealed OpcTransport CreateTransport()
vbnet
Protected NotOverridable Overrides Function CreateTransport() As OpcTransport

Returns

OpcTransport

A new instance of theOpcTransport class.

Overrides

CreateTransport()

DenyIfNotStarted ​

protected

Verifies whether the server is in started state.

csharp
protected void DenyIfNotStarted()
vbnet
Protected Sub DenyIfNotStarted()

Exceptions

ExceptionCondition
InvalidOperationExceptionThe State is not equals Started.

Dispose ​

protected · override

Releases the unmanaged resources used by the OpcServerBase and optionally releases the managed resources.

csharp
protected override void Dispose(bool disposing)
vbnet
Protected Overrides Sub Dispose(disposing As Boolean)

Parameters

NameTypeDescription
disposingBooleanThe value true to release both managed and unmanaged resources; otherwise the value false to release only unmanaged resources.

Overrides

Dispose(bool)

GetInfo ​

Gets the information about the product of the server.

csharp
public OpcServerInfo GetInfo()
vbnet
Public Function GetInfo() As OpcServerInfo

Returns

OpcServerInfo

The OpcServerInfo provided by GetInfoCore, which is kept for further calls; if GetInfoCore provides none, the information about the current process.

GetInfoCore ​

protected · virtual

Provides the information about the product of the server.

csharp
protected virtual OpcServerInfo GetInfoCore()
vbnet
Protected Overridable Function GetInfoCore() As OpcServerInfo

Returns

OpcServerInfo

An OpcServerInfo created from the entry assembly or, if there is none, from the current process. If the ApplicationName is set, it is used as the product name.

OnStarted ​

protected · virtual

Raises the Started event of the OpcServerBase.

csharp
protected virtual void OnStarted(EventArgs e)
vbnet
Protected Overridable Sub OnStarted(e As EventArgs)

Parameters

NameTypeDescription
eEventArgsThe event data.

OnStarting ​

protected · virtual

Raises the Starting event of the OpcServerBase.

csharp
protected virtual void OnStarting(EventArgs e)
vbnet
Protected Overridable Sub OnStarting(e As EventArgs)

Parameters

NameTypeDescription
eEventArgsThe event data.

OnStateChanged ​

protected · virtual

Raises the StateChanged event of the OpcServerBase.

csharp
protected virtual void OnStateChanged(OpcServerStateChangedEventArgs e)
vbnet
Protected Overridable Sub OnStateChanged(e As OpcServerStateChangedEventArgs)

Parameters

NameTypeDescription
eOpcServerStateChangedEventArgsThe event data.

OnStopped ​

protected · virtual

Raises the Stopped event of the OpcServerBase.

csharp
protected virtual void OnStopped(EventArgs e)
vbnet
Protected Overridable Sub OnStopped(e As EventArgs)

Parameters

NameTypeDescription
eEventArgsThe event data.

OnStopping ​

protected · virtual

Raises the Stopping event of the OpcServerBase.

csharp
protected virtual void OnStopping(EventArgs e)
vbnet
Protected Overridable Sub OnStopping(e As EventArgs)

Parameters

NameTypeDescription
eEventArgsThe event data.

OnSuspended ​

protected · virtual · since v2.50

Raises the Suspended event of the OpcServerBase.

csharp
protected virtual void OnSuspended(EventArgs e)
vbnet
Protected Overridable Sub OnSuspended(e As EventArgs)

Parameters

NameTypeDescription
eEventArgsThe event data.

OnSuspending ​

protected · virtual · since v2.50

Raises the Suspending event of the OpcServerBase.

csharp
protected virtual void OnSuspending(EventArgs e)
vbnet
Protected Overridable Sub OnSuspending(e As EventArgs)

Parameters

NameTypeDescription
eEventArgsThe event data.

RegisterAddress ​

2 overloads

OverloadDescription
RegisterAddress(string)Registers the address specified as one of the base addresses used by the server.
RegisterAddress(Uri)Registers the address specified as one of the base addresses used by the server.

RegisterAddress(string) ​

Registers the address specified as one of the base addresses used by the server.

csharp
public void RegisterAddress(string address)
vbnet
Public Sub RegisterAddress(address As String)

Parameters

NameTypeDescription
addressStringThe uniform resource identifier which defines the communication schema, the host, the port and optionally the path to listen to.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe address is a null reference (Nothing in Visual Basic).
ArgumentExceptionThe address is an empty string, is not an absolute URI or the address format / scheme can not be used as a server address.

Remarks

In case there the address is already in use as a base address, it will not be added to the list of base addresses a second time. In case there the Address properties is a null reference (Nothing in Visual Basic), the address will be used.

RegisterAddress(Uri) ​

Registers the address specified as one of the base addresses used by the server.

csharp
public void RegisterAddress(Uri address)
vbnet
Public Sub RegisterAddress(address As Uri)

Parameters

NameTypeDescription
addressUriThe Uri which defines the communication schema, the host, the port and optionally the path to listen to.

Exceptions

ExceptionCondition
ArgumentExceptionThe address is a null reference (Nothing in Visual Basic) or the address format / scheme can not be used as a server address.

Remarks

In case there the address is already in use as a base address, it will not be added to the list of base addresses a second time. In case there the Address properties is a null reference (Nothing in Visual Basic), the address will be used.

Resume ​

since v2.11

Resumes the suspended server.

csharp
public void Resume()
vbnet
Public Sub [Resume]()

Exceptions

ExceptionCondition
LicenseExceptionThe license is expired.
NotSupportedExceptionThe server does not support to be resumed (see ResumeCore).
OpcExceptionThe server could not be resumed; for more details see exception details.
ObjectDisposedExceptionThe object has been disposed of.

Remarks

The method resumes the server only in the state Suspended; in any other state it returns at once. While the server is being resumed, the State is Starting. If resuming fails, the State is reset to Suspended, which raises the StateChanged and Suspended events again.

ResumeCore ​

protected · virtual · since v2.11

When overridden in a derived class, resumes the suspended server.

csharp
protected virtual void ResumeCore()
vbnet
Protected Overridable Sub ResumeCore()

Exceptions

ExceptionCondition
NotSupportedExceptionAlways thrown by the base implementation.

Remarks

The method is called by Resume.

Setup ​

protected · override · since v2.6

Sets up the configuration specified before the server is started.

csharp
[CLSCompliant(false)]
protected override void Setup(OpcApplicationConfiguration configuration)
vbnet
<CLSCompliant(False)>
Protected Overrides Sub Setup(configuration As OpcApplicationConfiguration)

Parameters

NameTypeDescription
configurationOpcApplicationConfigurationThe OpcApplicationConfiguration created by CreateConfiguration.

Overrides

Setup(OpcApplicationConfiguration)

Remarks

The base addresses of the configuration start with the Addresses of the server, followed by the further base addresses of the configuration.

Start ​

Starts the server.

csharp
public void Start()
vbnet
Public Sub Start()

Exceptions

ExceptionCondition
InvalidOperationExceptionThe server has no base address (see Addresses).
LicenseExceptionThe license is expired.
OpcExceptionThe configuration is invalid or the server could not be started; for more details see exception details.
ObjectDisposedExceptionThe object has been disposed of.

Remarks

The method starts the server only in the state Created or Stopped; in any other state it returns at once. While the server is being started, the State is Starting. If starting fails, the State is reset to the state before, which raises the StateChanged event and, from the state Stopped, the Stopped event again.

StartCore ​

protected · virtual

When overridden in a derived class, starts the server using the configuration specified.

csharp
[CLSCompliant(false)]
protected virtual void StartCore(OpcApplicationConfiguration configuration)
vbnet
<CLSCompliant(False)>
Protected Overridable Sub StartCore(
    configuration As OpcApplicationConfiguration)

Parameters

NameTypeDescription
configurationOpcApplicationConfigurationThe OpcApplicationConfiguration created by CreateConfiguration and set up by Setup.

Remarks

The method is called by Start. The base implementation does nothing.

Stop ​

Stops the server.

csharp
public void Stop()
vbnet
Public Sub [Stop]()

Exceptions

ExceptionCondition
LicenseExceptionThe license is expired.
OpcExceptionThe server could not be stopped; for more details see exception details.
ObjectDisposedExceptionThe object has been disposed of.

Remarks

The method stops the server only in the state Started or Suspended; in any other state it returns at once. While the server is being stopped, the State is Stopping. If stopping fails, the State is reset to the state before, which raises the StateChanged event and the event of that state again.

StopCore ​

protected · abstract

When implemented in a derived class, stops the server.

csharp
protected abstract void StopCore()
vbnet
Protected MustOverride Sub StopCore()

Remarks

The method is called by Stop.

Suspend ​

since v2.11

Suspends the started server.

csharp
public void Suspend()
vbnet
Public Sub Suspend()

Exceptions

ExceptionCondition
LicenseExceptionThe license is expired.
NotSupportedExceptionThe server does not support to be suspended (see SuspendCore).
OpcExceptionThe server could not be suspended; for more details see exception details.
ObjectDisposedExceptionThe object has been disposed of.

Remarks

The method suspends the server only in the state Started; in any other state it returns at once. While the server is being suspended, the State is Suspending. If suspending fails, the State is reset to Started, which raises the StateChanged and Started events again.

SuspendCore ​

protected · virtual · since v2.11

When overridden in a derived class, suspends the started server.

csharp
protected virtual void SuspendCore()
vbnet
Protected Overridable Sub SuspendCore()

Exceptions

ExceptionCondition
NotSupportedExceptionAlways thrown by the base implementation.

Remarks

The method is called by Suspend.

UnregisterAddress ​

2 overloads

OverloadDescription
UnregisterAddress(string)Unregisters the address specified from the list of base addresses used by the server.
UnregisterAddress(Uri)Unregisters the address specified from the list of base addresses used by the server.

Exceptions (all overloads)

ExceptionCondition
ArgumentNullExceptionThe address is a null reference (Nothing in Visual Basic).

UnregisterAddress(string) ​

Unregisters the address specified from the list of base addresses used by the server.

csharp
public void UnregisterAddress(string address)
vbnet
Public Sub UnregisterAddress(address As String)

Parameters

NameTypeDescription
addressStringThe uniform resource identifier which defines the communication schema, the host, the port and optionally the path to remove.

Exceptions

ExceptionCondition
ArgumentExceptionThe address is an empty string.
FormatExceptionThe address is not a valid URI format.

Remarks

In case there address is equals to Address the Address property will be set to a null reference (Nothing in Visual Basic) if there is no other address registered; otherwise the first entry in Addresses will be used for Address.

UnregisterAddress(Uri) ​

Unregisters the address specified from the list of base addresses used by the server.

csharp
public void UnregisterAddress(Uri address)
vbnet
Public Sub UnregisterAddress(address As Uri)

Parameters

NameTypeDescription
addressUriThe Uri which defines the communication schema, the host, the port and optionally the path to remove.

Remarks

In case there address is equals to Address the Address property will be set to a null reference (Nothing in Visual Basic) if there is no other address registered; otherwise the first entry in Addresses will be used for Address.

Events ​

Started ​

Occurs when the State of the server changes to Started.

csharp
public event EventHandler Started
vbnet
Public Event Started As EventHandler

Event type

EventHandler

Starting ​

Occurs when the State of the server changes to Starting.

csharp
public event EventHandler Starting
vbnet
Public Event Starting As EventHandler

Event type

EventHandler

StateChanged ​

Occurs when ever the State property has been changed to a different value.

csharp
public event EventHandler<OpcServerStateChangedEventArgs> StateChanged
vbnet
Public Event StateChanged As EventHandler(Of OpcServerStateChangedEventArgs)

Event type

EventHandler<OpcServerStateChangedEventArgs>

Stopped ​

Occurs when the State of the server changes to Stopped.

csharp
public event EventHandler Stopped
vbnet
Public Event Stopped As EventHandler

Event type

EventHandler

Stopping ​

Occurs when the State of the server changes to Stopping.

csharp
public event EventHandler Stopping
vbnet
Public Event Stopping As EventHandler

Event type

EventHandler

Suspended ​

since v2.50

Occurs when the State of the server changes to Suspended.

csharp
public event EventHandler Suspended
vbnet
Public Event Suspended As EventHandler

Event type

EventHandler

Suspending ​

since v2.50

Occurs when the State of the server changes to Suspending.

csharp
public event EventHandler Suspending
vbnet
Public Event Suspending As EventHandler

Event type

EventHandler