<< Click to Display Table of Contents >>
ServerStatus |
Determines the status of an OPC Server connection. This is a read-only property. The available options are described on the next table.
Available options for the ServerStatus property
Option |
Description |
---|---|
-1 - ServerStatus_Unknown |
The OPC Driver is connected to an OPC Server but either status is not informed or OPC Client's ReconnectPeriod property is set to zero (default) |
0 - ServerStatus_NotConnected |
The OPC Driver is not connected to an OPC Server. This happens when, for example, an OPC Driver is not active, or a connection was not established yet for any reason |
The following values are only informed when the ReconnectPeriod property is different from 0 (zero). This time period specifying a status is retrieved from the OPC Server. In case this status is not correctly informed, this property can maintain its value in -1 (minus one), or the disconnection can be detected in this case, which brings this property to 0 (zero). Values are based on the five default status types defined for OPC Servers.
Available options for ReconnectPeriod different from zero
Option |
Description |
---|---|
1 - ServerStatus_Running |
OPC Server is executing normally |
2 - ServerStatus_Failed |
OPC Server is not executing. An unspecified error occurred on the OPC Server |
3 - ServerStatus_NoConfig |
OPC Server is executing, but without information about its configuration |
4 - ServerStatus_Suspended |
OPC Server was temporarily suspended |
5 - ServerStatus_Test |
OPC Server is in test mode |
The next script contains an example of using this property.
Sub CommandButton1_Click()
Dim status
status = Application.GetObject("OPCDriver1").ServerStatus
MsgBox "Driver status is " & status
Select Case status
Case -1
MsgBox "OPC Driver is connected to the OPC Server_
but its status was not informed."
Case 0
MsgBox "OPC Driver is not connected to an OPC Server."
Case 1
MsgBox "The OPC Server is running normally."
Case 2
MsgBox "The OPC Server is not running."
Case 3
MsgBox "The OPC Server is running without information_
on its configuration."
Case 4
MsgBox "The OPC Server has been temporarily suspended."
Case 5
MsgBox "The OPC Server is running in Test Mode."
End Select
End Sub
NOTE |
To obtain a behavior equivalent to a Boolean property, it is recommended to use this property different from 0 (zero). This basically differentiates only between having or not having a connection, without considering more specific OPC Server statuses. In addition, this expression does not depend on using the ReconnectPeriod property different from 0 (zero). |