How To Query an Out-Of-Proc OPC Server for Client Connections
On an 800xA node, it is noticed that the AfwDsOpcSurrogate.exe process is running. However, it is not known what is connected to it. Without knowing for sure, it is not desired to simply kill the process, in the event that, for example, a historian (such as PI) is legitimately gathering data from the server. This article will outline two very simple methods to determine what machine has initiated a connection to that server.Symptoms:
In this example, the AfwDsOpcSurrogate local server will be used. If the following is seen in the Windows Task Manager, then an OPC client (somewhere) has initiated a connection to that server:
Sometimes, it is not known where the connection is coming from.
To narrow down what has initiated the connection, two utilities can be used, the command-line utility "netstat" and TcpView (part of SysInternals).
First, on the machine hosting the Surrogate OPC server (i.e. an 800xA node that has the process above running), open a command prompt (Start...Run...cmd) and type the following:
The "-b" switch will return the names of the executable files involved in making the connection or opening the listening port.
You should see a result similar to the image below. Look for the executable above (AfwDsOpcSurrogate.exe):
From the image above, you can see that a two connections are being made on different TCP ports. Because the remote (connecting) node happens to be in the HOSTS file on the local node, we see the computer name of the machine initiating the connection. If the name were not able to be resolved, you would see an IP address instead.
Using TcpView, we can also see the connections to the Surrogate executable (again, if the name resolves, we can see the computer name, otherwise an IP address):