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
| Overload | Description |
|---|---|
| OpcServerBase( | Initializes a new instance of the OpcServerBase class using the type specified. |
| OpcServerBase( | Initializes a new instance of the OpcServerBase class using the type and address specified. |
| OpcServerBase( | Initializes a new instance of the OpcServerBase class using the type and address specified. |
OpcServerBase(OpcServerType)
Initializes a new instance of the OpcServerBase class using the type specified.
protected OpcServerBase(OpcServerType type)Protected Sub New(type As OpcServerType)Parameters
| Name | Type | Description |
|---|---|---|
type | OpcServerType | One of the members defined by the OpcServerType enumeration which specifies the type of the server. |
Exceptions
| Exception | Condition |
|---|---|
| LicenseException | The license is expired. |
OpcServerBase(OpcServerType, string)
Initializes a new instance of the OpcServerBase class using the type and address specified.
protected OpcServerBase(OpcServerType type, string address)Protected Sub New(type As OpcServerType, address As String)Parameters
| Name | Type | Description |
|---|---|---|
type | OpcServerType | One of the members defined by the OpcServerType enumeration which specifies the type of the server. |
address | String | The string representation of the address of the server which needs to use one of the supported schemes 'opc. |
Exceptions
| Exception | Condition |
|---|---|
| Argument | The address is equals Empty or is not an absolute URI using one of the supported schemes 'opc. |
| Argument | The address is a null reference ( |
OpcServerBase(OpcServerType, Uri)
Initializes a new instance of the OpcServerBase class using the type and address specified.
protected OpcServerBase(OpcServerType type, Uri address)Protected Sub New(type As OpcServerType, address As Uri)Parameters
| Name | Type | Description |
|---|---|---|
type | OpcServerType | One of the members defined by the OpcServerType enumeration which specifies the type of the server. |
address | Uri | The Uri of the address of the server which needs to use one of the supported schemes 'opc. |
Exceptions
| Exception | Condition |
|---|---|
| Argument | The address does not use one of the supported schemes 'opc. |
| Argument | The address is a null reference ( |
Properties
Address
Gets or sets the (first) base address of the server.
public Uri Address { get; set; }Public Property Address As UriProperty value
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
| Exception | Condition |
|---|---|
| Argument | The value is a null reference ( |
Addresses
Gets a read-only collection of Uri instances representing the base addresses used by the server.
public ReadOnlyCollection<Uri> Addresses { get; }Public ReadOnly Property Addresses As ReadOnlyCollection(Of Uri)Property value
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
Gets the OpcAuthenticationLimits instance used to maintain the different authentication limits used by the server.
public OpcAuthenticationLimits AuthenticationLimits { get; }Public ReadOnly Property AuthenticationLimits As OpcAuthenticationLimitsProperty value
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.
public OpcServerBinding Binding { get; }Public ReadOnly Property Binding As OpcServerBindingProperty value
An instance of the OpcServerBinding class used by the OpcServer to setup and maintain the different binding options.
Configuration
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.
[CLSCompliant(false)]
public override OpcApplicationConfiguration Configuration { get; set; }<CLSCompliant(False)>
Public Overrides Property Configuration As OpcApplicationConfigurationProperty value
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
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.
public string Name { get; set; }Public Property Name As StringProperty value
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
Gets a read-only collection of namespaces used by the server.
public override OpcReadOnlyNamespaceCollection Namespaces { get; }Public Overrides ReadOnly Property Namespaces As OpcReadOnlyNamespaceCollectionProperty 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
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.
public OpcServerState State { get; }Public ReadOnly Property State As OpcServerStateProperty value
One of the members defined by the OpcServerState enumeration. Which specifies the current state of the server.
Methods
CreateAuthenticationLimits
Creates a new instance of the OpcAuthenticationLimits class.
protected virtual OpcAuthenticationLimits CreateAuthenticationLimits()Protected Overridable Function CreateAuthenticationLimits() As OpcAuthenticationLimitsReturns
A new instance of theOpcAuthenticationLimits class.
CreateConfiguration
Creates the configuration which is used to start the server.
[CLSCompliant(false)]
protected virtual OpcApplicationConfiguration CreateConfiguration()<CLSCompliant(False)>
Protected Overridable Function CreateConfiguration() As OpcApplicationConfigurationReturns
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
Creates a new instance of the OpcServerSecurity class.
protected override sealed OpcServerSecurity CreateSecurity()Protected NotOverridable Overrides Function CreateSecurity() As OpcServerSecurityReturns
A new instance of theOpcServerSecurity class.
Overrides
CreateTransport
Creates a new instance of the OpcTransport class.
protected override sealed OpcTransport CreateTransport()Protected NotOverridable Overrides Function CreateTransport() As OpcTransportReturns
A new instance of theOpcTransport class.
Overrides
DenyIfNotStarted
Verifies whether the server is in started state.
protected void DenyIfNotStarted()Protected Sub DenyIfNotStarted()Exceptions
| Exception | Condition |
|---|---|
| Invalid | The State is not equals Started. |
Dispose
Releases the unmanaged resources used by the OpcServerBase and optionally releases the managed resources.
protected override void Dispose(bool disposing)Protected Overrides Sub Dispose(disposing As Boolean)Parameters
| Name | Type | Description |
|---|---|---|
disposing | Boolean | The value true to release both managed and unmanaged resources; otherwise the value false to release only unmanaged resources. |
Overrides
GetInfo
Gets the information about the product of the server.
public OpcServerInfo GetInfo()Public Function GetInfo() As OpcServerInfoReturns
The OpcServerInfo provided by GetInfoCore, which is kept for further calls; if GetInfoCore provides none, the information about the current process.
GetInfoCore
Provides the information about the product of the server.
protected virtual OpcServerInfo GetInfoCore()Protected Overridable Function GetInfoCore() As OpcServerInfoReturns
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
Raises the Started event of the OpcServerBase.
protected virtual void OnStarted(EventArgs e)Protected Overridable Sub OnStarted(e As EventArgs)Parameters
| Name | Type | Description |
|---|---|---|
e | EventArgs | The event data. |
OnStarting
Raises the Starting event of the OpcServerBase.
protected virtual void OnStarting(EventArgs e)Protected Overridable Sub OnStarting(e As EventArgs)Parameters
| Name | Type | Description |
|---|---|---|
e | EventArgs | The event data. |
OnStateChanged
Raises the StateChanged event of the OpcServerBase.
protected virtual void OnStateChanged(OpcServerStateChangedEventArgs e)Protected Overridable Sub OnStateChanged(e As OpcServerStateChangedEventArgs)Parameters
| Name | Type | Description |
|---|---|---|
e | Opc | The event data. |
OnStopped
Raises the Stopped event of the OpcServerBase.
protected virtual void OnStopped(EventArgs e)Protected Overridable Sub OnStopped(e As EventArgs)Parameters
| Name | Type | Description |
|---|---|---|
e | EventArgs | The event data. |
OnStopping
Raises the Stopping event of the OpcServerBase.
protected virtual void OnStopping(EventArgs e)Protected Overridable Sub OnStopping(e As EventArgs)Parameters
| Name | Type | Description |
|---|---|---|
e | EventArgs | The event data. |
OnSuspended
Raises the Suspended event of the OpcServerBase.
protected virtual void OnSuspended(EventArgs e)Protected Overridable Sub OnSuspended(e As EventArgs)Parameters
| Name | Type | Description |
|---|---|---|
e | EventArgs | The event data. |
OnSuspending
Raises the Suspending event of the OpcServerBase.
protected virtual void OnSuspending(EventArgs e)Protected Overridable Sub OnSuspending(e As EventArgs)Parameters
| Name | Type | Description |
|---|---|---|
e | EventArgs | The event data. |
RegisterAddress
| Overload | Description |
|---|---|
| RegisterAddress( | Registers the address specified as one of the base addresses used by the server. |
| RegisterAddress( | 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.
public void RegisterAddress(string address)Public Sub RegisterAddress(address As String)Parameters
| Name | Type | Description |
|---|---|---|
address | String | The uniform resource identifier which defines the communication schema, the host, the port and optionally the path to listen to. |
Exceptions
| Exception | Condition |
|---|---|
| Argument | The address is a null reference ( |
| Argument | The 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.
public void RegisterAddress(Uri address)Public Sub RegisterAddress(address As Uri)Parameters
| Name | Type | Description |
|---|---|---|
address | Uri | The Uri which defines the communication schema, the host, the port and optionally the path to listen to. |
Exceptions
| Exception | Condition |
|---|---|
| Argument | The address is a null reference ( |
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
Resumes the suspended server.
public void Resume()Public Sub [Resume]()Exceptions
| Exception | Condition |
|---|---|
| LicenseException | The license is expired. |
| Not | The server does not support to be resumed ( |
| OpcException | The server could not be resumed; for more details see exception details. |
| Object | The 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
When overridden in a derived class, resumes the suspended server.
protected virtual void ResumeCore()Protected Overridable Sub ResumeCore()Exceptions
| Exception | Condition |
|---|---|
| Not | Always thrown by the base implementation. |
Remarks
The method is called by Resume.
Setup
Sets up the configuration specified before the server is started.
[CLSCompliant(false)]
protected override void Setup(OpcApplicationConfiguration configuration)<CLSCompliant(False)>
Protected Overrides Sub Setup(configuration As OpcApplicationConfiguration)Parameters
| Name | Type | Description |
|---|---|---|
configuration | Opc | The Opc |
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.
public void Start()Public Sub Start()Exceptions
| Exception | Condition |
|---|---|
| Invalid | The server has no base address ( |
| LicenseException | The license is expired. |
| OpcException | The configuration is invalid or the server could not be started; for more details see exception details. |
| Object | The 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
When overridden in a derived class, starts the server using the configuration specified.
[CLSCompliant(false)]
protected virtual void StartCore(OpcApplicationConfiguration configuration)<CLSCompliant(False)>
Protected Overridable Sub StartCore(
configuration As OpcApplicationConfiguration)Parameters
| Name | Type | Description |
|---|---|---|
configuration | Opc | The Opc |
Remarks
The method is called by Start. The base implementation does nothing.
Stop
Stops the server.
public void Stop()Public Sub [Stop]()Exceptions
| Exception | Condition |
|---|---|
| LicenseException | The license is expired. |
| OpcException | The server could not be stopped; for more details see exception details. |
| Object | The 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
When implemented in a derived class, stops the server.
protected abstract void StopCore()Protected MustOverride Sub StopCore()Remarks
The method is called by Stop.
Suspend
Suspends the started server.
public void Suspend()Public Sub Suspend()Exceptions
| Exception | Condition |
|---|---|
| LicenseException | The license is expired. |
| Not | The server does not support to be suspended ( |
| OpcException | The server could not be suspended; for more details see exception details. |
| Object | The 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
When overridden in a derived class, suspends the started server.
protected virtual void SuspendCore()Protected Overridable Sub SuspendCore()Exceptions
| Exception | Condition |
|---|---|
| Not | Always thrown by the base implementation. |
Remarks
The method is called by Suspend.
UnregisterAddress
| Overload | Description |
|---|---|
| Unregister | Unregisters the address specified from the list of base addresses used by the server. |
| Unregister | Unregisters the address specified from the list of base addresses used by the server. |
Exceptions (all overloads)
| Exception | Condition |
|---|---|
| Argument | The address is a null reference ( |
UnregisterAddress(string)
Unregisters the address specified from the list of base addresses used by the server.
public void UnregisterAddress(string address)Public Sub UnregisterAddress(address As String)Parameters
| Name | Type | Description |
|---|---|---|
address | String | The uniform resource identifier which defines the communication schema, the host, the port and optionally the path to remove. |
Exceptions
| Exception | Condition |
|---|---|
| Argument | The address is an empty string. |
| FormatException | The 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.
public void UnregisterAddress(Uri address)Public Sub UnregisterAddress(address As Uri)Parameters
| Name | Type | Description |
|---|---|---|
address | Uri | The 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.
public event EventHandler StartedPublic Event Started As EventHandlerEvent type
Starting
Occurs when the State of the server changes to Starting.
public event EventHandler StartingPublic Event Starting As EventHandlerEvent type
StateChanged
Occurs when ever the State property has been changed to a different value.
public event EventHandler<OpcServerStateChangedEventArgs> StateChangedPublic Event StateChanged As EventHandler(Of OpcServerStateChangedEventArgs)Event type
EventHandler<OpcServerStateChangedEventArgs>
Stopped
Occurs when the State of the server changes to Stopped.
public event EventHandler StoppedPublic Event Stopped As EventHandlerEvent type
Stopping
Occurs when the State of the server changes to Stopping.
public event EventHandler StoppingPublic Event Stopping As EventHandlerEvent type
Suspended
Occurs when the State of the server changes to Suspended.
public event EventHandler SuspendedPublic Event Suspended As EventHandlerEvent type
Suspending
Occurs when the State of the server changes to Suspending.
public event EventHandler SuspendingPublic Event Suspending As EventHandlerEvent type

