Networking Ports
As outlined on the Getting Started – Networking page, OAS has two main ports used by OAS Engine to OAS Engine and OAS Engine to client communications, depending on whether the client is using TCP connectivity or web-based connectivity using HTTP. For OAS Engine to OAS Engine communication, and when using the OAS Configure tool, there is also a third port, which is the backup port number in case there is a problem with the primary port number.
There is one additional port for the OAS OPC UA server.
For legacy support for Windows Communication Framework (WCF) port [58724] and Classic .NET (remoting) port [58723] are not currently support in the latest version of OAS.
The default TCP port number for .NET applications, Microsoft Excel, OPCSystems.NET OPC Server, the OAS Configuration tool and service to service communications is 58727. The default web port for web applications and the REST API (which includes UIEngine) is 58725.
Changing these ports is not generally required, however if you have specific networking needs then you can follow the relevant instructions below to adjust these port numbers.
OAS Engine – Listening and Client Ports
There are two types of ports that can be configured in each OAS Engine – listening port numbers and client port number.
The listening port numbers are the ports on which an OAS Engine (let’s call it the local engine) listens for connections as shown on the left hand side in the above diagram. These ports are used when another OAS Engine (let’s call it the remote engine) or a client connects to the local engine. When clients connect to an OAS Engine their purpose is to read and write tag data, but why would a remote engine need to connect to a local OAS Engine?
The answer to this question is Basic Networking and Live Data Cloud. Whenever any remote engine (e.g. Instance2 below) references a tag path that points to the local engine (e.g. Instance1 below), then the remote engine will establish a connection to the local engine and poll the tag value for the given tag path. These kinds of remote tag references can appear wherever you are referencing a tag using a tag path. This could be in a Tag Data Source, in a Data Logging configuration, in a Data Route or even if a client connects to a remote engine with a read or write request that references a tag on the local engine.
If the listening port is changed on the local engine, this port number also needs to be correctly configured on all of the clients and the remote engines that want to connect to the local engine. This is called the client port number. In a standard configuration the listening port on the local engine and the client port on the remote engine will be the same (58727) and therefore don’t need to be changed, but if you change the listening port on a local engine, you also have to change the client port configuration on the remote engine or use remote tag paths that also include the port number.
In short, you can think of it this way from the point of view of the OAS Engine: The listening port is configured to the port number where I want other engines and clients to connect to read data from my tags or write data to my tags. The client port is configured to the port number I need to connect to when I want to read tag data from or write tag data to another engine. This is an example of a remote tag path that also specifies the port number:
\\192.168.10.1:58777\MyTag.Value
The OAS Engine where the remote tag path is specified will be the one to initiate the connection. If two OAS Engines contain tag paths to each other’s tags then this will result in two TCP connections – one in each direction.
Currently, each OAS Engine can only be configured to listen on one port (ignoring the backup port) and connect to one default client port. This means you can still access remote tags on different OAS Engines, but they will all need to use the same listening port or you will need to specify both the IP and port number in your tag path. Generally, if you have more than one OAS Engine in your solution, you will use the default ports on each engine.
Configure Listening Ports
To configure the listening port numbers, open the OAS Configure application and go to the Configure > Options screen and select the Networking tab.
Here you can adjust the following parameters:
- Primary Port Number
- Backup Port Number
- OAS OPC UA Server Port
- REST API and Web Port Number
Classic TCP
The Classic TCP packet support is disabled by default. You can enable it in the OAS Configure application on the Networking tab of the Configure > Options screen. To enable it make sure the “Enable classic TCP (Unsecure)” check box is ticked. The Classic TCP port number is set by the Primary Port Number and Backup Port Number properties.
Classic WCF Port
The Classic WCF port 58724 is no longer supported in the current version of OAS.
Classic .NET Remoting
The Classic .NET Remoting port 58723 is no longer supported in the current version of OAS.
Configure Client Ports
To configure the client port numbers open the OAS Configure application and go to the Configure > Options screen and select the Remote Services tab.
OAS Service Control Tool
The OAS Service control tool is used to view the status of your OAS services and runtime, and to start or stop the OAS services. If you adjust your OAS Engine listening port numbers you will also need to adjust the port numbers in this tool if you want to use it to view the runtime status and the license details. Even if these ports are not correctly set you will still be able to start and stop the services as these are managed directly through Windows services and not an OAS connection.
The image below shows an example where the primary port is now 58777 and the backup port is now 58778.
Technically only one of the two ports needs to be correctly set and a green text color will indicate which port is being used, but it is best to make sure both ports are correctly set. In the image above, the Primary Port 58777 is currently being used by the OAS Service Control tool. The main purpose of the backup port is to allow you to recover the OAS connection in case the primary port is no longer available, has been blocked or has become unresponsive.
OAS Configure Tool
The OAS Configure tool is the main Windows GUI based OAS configuration tool and can be used to connect to local and remote OAS instances. The Network Node and the Primary and Backup Port settings can be configured on each of the configuration screens along the top of the view.
In the following example, the OAS Configure tool is being used to connect to a local OAS Engine instance using a Primary Port 58777 and a Backup Port 58737. The “Primary Port” text is green as it indicates that this is the port number that OAS is currently using to communicate with the OAS Engine. The red color indicates that the configured port is not the default port.
If you are using the OAS Configure tool to connect to different OAS instances on different servers and one or more engines is not using the default port numbers, you will have to adjust these port numbers each time you connect to a different engine. Again, if possible, it is more convenient if all engines can use the same port numbers.
Microsoft Excel
Microsoft Excel can be used together with the OAS Excel feature to read and write OAS tag data. If you only specify the tag page, the OASRead function will use localhost and port 58727 as the default connection parameters. However, you can override this by specifying a full tag page with the IP or host name as well as the port number to connect to. In the following example, the tag is being read from localhost but using port number 58777.
You can also use the legacy RTD method to read and write OAS tag data. This method is supported on OAS version 17 or lower. To use this method you will need to specify a cell in Excel that uses the “Networking” parameter and also the “Read” parameter for reading.
You can examine these methods using the OAS Excel Tag Browsing tool. You find this tool in the Windows Start Menu or in the OAS Configure tool by going to the Configure > Excel menu.
Once you have copied this formula into Excel you can then also generate a Read operation.
WinForm HMI .NET
There are two ways in which you can configure the port number when using OAS controls in your Windows Forms applications. The first method is to add the OPCControlsNetworkNodes component to your Form and set the TCPPortNumber parameter to the desired port number. The second method is to use the remote tag path syntax to specify the OAS Engine IP or hostname and port number. Let’s look at this in more detail.
Using OPCControlsNetworkNodes
When you use this method it will apply to all OAS controls added to your Form. If you only need to override a few controls you can use the remote tag syntax shown in the next section.
- In your Windows Forms project you will have your main Form design shown. Open up the Toolbox panel and then find and drag the OPCControlsNetworkNodes component onto the Form.
- You will see this component appear in the panel below the form. Click on it.
- In the Properties panel you can now adjust the TCPPortNumber parameter.
To programmatically adjust this port number, you can reference the opcControlsNetworkNodes instance that was created.
public Form1()
{
InitializeComponent();
opcControlsNetworkNodes.TCPPortNumber = 58777;
}
Using Remote Tag Path
If you need to override a specific Tag in a control you can use the remote tag path syntax.
- Select the control where you want to set the Tag value. Let’s say an OPCControlsLabel.
- If you want to make the Text property update based on a tag value you can set this to a remote tag path.
\\localhost:58777\Random.Value
WPF HMI .NET
There are two ways in which you can configure the port number when using OAS controls in your WPF applications. The first method is to create an instance of the OPCWPFNetworkNodes component in your MainWindow and set the TCPPortNumber parameter to the desired port number. The second method is to use the remote tag path syntax to specify the OAS Engine IP or hostname and port number. Let’s look at this in more detail.
Using OPCWPFNetworkNodes
When you use this method it will apply to all OAS controls added to your Window. If you only need to override a few controls you can use the remote tag syntax shown in the next section.
- Open the source code of your MainWindow class.
- In the constructor add the following code.
private readonly OPCWPFDashboard.OPCWPFNetworkNodes _oasNetworkNodes;
public MainWindow()
{
InitializeComponent();
_oasNetworkNodes = new OPCWPFDashboard.OPCWPFNetworkNodes();
_oasNetworkNodes.TCPPortNumber = 58777;
}
Using Remote Tag Path
If you need to override a specific Tag in a control you can use the remote tag path syntax.
- Select the control where you want to set the Tag value. Let’s say an OPCWPFLabel.
- If you want to make the Content property update based on a tag value you can set the Content_Tag property to a remote tag path.
\\localhost:58777\Random.Value
The end result is we get the value updating from the Random.Value tag on port 58777.
.NET Data Connector: OPCSystemsDataConnector.OPCSystemsDataNetworkNodes.TCPPortNumber
Trend .NET: OPCTrendControl.TCPPortNumber
Alarm .NET: OPCAlarmControl.TCPPortNumber
OPCSystems.NET OPC Server: Modify the file DANSrv.exe.config with Notepad to change <add key=”TCPPortNumber” value=”58727″/>