Communication
Connection setup
The connection to the server is set up, as described in the chapter Initial setup of OPC communication, when the client is started up. A data request starts when the server has the status RUNNING.
Connection monitoring
In the connection monitoring, only the connection between server and client is monitored, and not the connection between server and hardware. But the server has two ways of notifying the client of a potential hardware failure:
-
The first possibility is to ask the client to interrupt the connection to the server via the IOPCShutdown.
-
The second option is to set the server status accordingly.
OPCIfceShutdown
The server can use this client-side interface to make the client disconnect from the server. The driver reacts to such a request by releasing all interfaces in the server. As soon as all interfaces are released, the reconnection timer starts running. After the timer interval has expired, the client tries again to establish the connection to the server. If this is successful, all groups are created in the server once more as they were when the shutdown occurred. However, this mechanism can only be used by DA 2.0 servers.
Using ServerStatus
Since the server status is periodically queried by the driver, it is used for connection monitoring. If the server status cannot be queried, the driver assumes that there is no longer a connection to the server. In this case too, the reconnection timer is started, and periodic attempts are made to set up a connection to the server. If the connection to the server can be established again, the procedure is the same as after a shutdown by the server.
Connection termination by client
If the client is stopped, all groups in the server are deleted and all interfaces are released. An inproc server is then automatically terminated, a local server not necessarily. No reconnect to the server is attempted, since the program is finished.
Connection termination by server
See Connection monitoring and the description of the OPCIfceShutdown.